当前位置: 首页>>代码示例>>Python>>正文


Python Worksheet.name方法代码示例

本文整理汇总了Python中dirigible.sheet.worksheet.Worksheet.name方法的典型用法代码示例。如果您正苦于以下问题:Python Worksheet.name方法的具体用法?Python Worksheet.name怎么用?Python Worksheet.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dirigible.sheet.worksheet.Worksheet的用法示例。


在下文中一共展示了Worksheet.name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_iteration_yields_cells

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_iteration_yields_cells(self):
        ws = Worksheet()
        ws[1, 1].formula = 'A1'
        ws[2, 4].formula = 'B4'
        ws.name = 'any old name'

        self.assertEquals(ws.items(), [((1, 1), ws[1, 1]), ((2, 4), ws[2, 4])])
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:9,代码来源:test_worksheet.py

示例2: test_run_worksheet_with_overrides

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_run_worksheet_with_overrides(self, mock_urllib2):
        self.maxDiff = None

        cellA2 = Cell()
        cellA2.formula = '1'
        cellA2.value = 1

        cellC3 = Cell()
        cellC3.formula = '5'
        cellC3.value = 5

        cellE4 = Cell()
        cellE4.formula = '=A2 + C3'
        cellE4.value = 6

        overrides = {
            (1, 2): '11',
            (3, 3): 55,
            (4, 1): '="abc"',
            'dirigible_l337_private_key': sentinel.private_key
        }

        result_of_calculation_json = '''{
            "name": "Untitled",
            "1": {
                "2": 11
            },
            "3": {
                "3": 55
            },
            "4": {
                "1": "abc"
            },
            "5": {
                "4": 66
            }
        }'''

        mock_opener = mock_urllib2.build_opener.return_value
        mock_urlopen_file = mock_opener.open.return_value
        mock_urlopen_file.read.return_value = result_of_calculation_json

        worksheet_url = 'ws_url/'
        result = run_worksheet(worksheet_url, overrides, sentinel.private_key)

        target_url = '%sv%s/json/' % (worksheet_url, CURRENT_API_VERSION)
        self.assertCalledOnce(mock_opener.open, target_url, data=urlencode(overrides))
        self.assertEquals(type(result), Worksheet)
        expected_sheet = Worksheet()
        expected_sheet.name = 'Untitled'
        expected_sheet[1, 2].value = 11
        expected_sheet[3, 3].value = 55
        expected_sheet[4, 1].value = 'abc'
        expected_sheet[5, 4].value = 66

        self.assertEquals(result, expected_sheet)
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:58,代码来源:test_calculate.py

示例3: api_json_to_worksheet

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
def api_json_to_worksheet(sheet_json):
    sheet_values = jsonlib.loads(sheet_json)
    worksheet = Worksheet()

    worksheet.name = sheet_values.get('name', 'Untitled')
    for key, value in sheet_values.iteritems():
        if key == "usercode_error":
            worksheet._usercode_error = value
        elif isinstance(value, dict):
            rows = value
            col = int(key)
            for row, value in rows.iteritems():
                row = int(row)
                worksheet[col, row].value = value
    return worksheet
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:17,代码来源:calculate.py

示例4: test_equality

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_equality(self):
        ws1 = Worksheet()
        ws2 = Worksheet()
        ws2.A1.formula = 'a difference'
        self.assertFalse(ws1==ws2)
        self.assertTrue(ws1!=ws2)

        ws3 = Worksheet()
        self.assertTrue(ws1==ws3)
        self.assertFalse(ws1!=ws3)

        ws3.name = 'a different name!'
        self.assertFalse(ws1==ws3)
        self.assertTrue(ws1!=ws3)

        nonWs = 1.2
        self.assertFalse(ws1==nonWs)
        self.assertTrue(ws1!=nonWs)
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:20,代码来源:test_worksheet.py

示例5: test_values

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_values(self):
        json = u'''
        {
            "name": "sheetname",
            "1": {
                "2": "abc",
                "3": "123",
                "4": 123,
                "5": [1, 2, 3, 4],
                "6": "unescaped & unicod\xe9"
            }
        }
        '''
        actual = api_json_to_worksheet(json)
        expected = Worksheet()
        expected.name = 'sheetname'
        expected[1, 2].value = 'abc'
        expected[1, 3].value = '123'
        expected[1, 4].value = 123
        expected[1, 5].value = [1L, 2L, 3L, 4L]
        expected[1, 6].value = u'unescaped & unicod\xe9'

        self.assertEquals(actual, expected)
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:25,代码来源:test_calculate.py

示例6: test_run_worksheet_should_return_worksheet_with_calculated_values_only

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_run_worksheet_should_return_worksheet_with_calculated_values_only(self, mock_urllib2):
        self.maxDiff = None

        original_sheet = Worksheet()

        original_sheet.A2.formula = '1'
        original_sheet.A2.value = 1

        original_sheet.C3.formula = '5'
        original_sheet.C3.value = 5

        original_sheet.E4.formula = '=A2 + C3'
        original_sheet.E4.value = 6

        expected_sheet = Worksheet()
        expected_sheet.name = 'Untitled'
        for (col, row), cell in original_sheet.items():
            expected_sheet[col, row].value = cell.value
        foreign_sheet = Sheet()
        foreign_sheet.owner = User(username='skeletor', password='1havTehpowa')
        foreign_sheet.owner.save()
        foreign_sheet.contents_json = worksheet_to_json(original_sheet)
        foreign_sheet.calculate()

        mock_opener = mock_urllib2.build_opener.return_value
        mock_urlopen_file = mock_opener.open.return_value
        mock_urlopen_file.read.return_value = _sheet_to_value_only_json(
            foreign_sheet.name, worksheet_from_json(foreign_sheet.contents_json)
        )

        worksheet_url = 'ws_url/'
        result = run_worksheet(worksheet_url, None, sentinel.private_key)

        target_url = '%sv%s/json/' % (worksheet_url, CURRENT_API_VERSION)
        self.assertCalledOnce(mock_opener.open, target_url, data=urlencode({'dirigible_l337_private_key': sentinel.private_key}))
        self.assertEquals(type(result), Worksheet)
        self.assertEquals(result, expected_sheet)
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:39,代码来源:test_calculate.py

示例7: test_repr

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import name [as 别名]
    def test_repr(self):
        ws = Worksheet()
        self.assertEquals(repr(ws), '<Worksheet>')

        ws.name = 'test worksheet'
        self.assertEquals(repr(ws), '<Worksheet test worksheet>')
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:8,代码来源:test_worksheet.py


注:本文中的dirigible.sheet.worksheet.Worksheet.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。