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


Python Worksheet.to_location方法代码示例

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


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

示例1: test_to_location

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_to_location(self):
        ws = Worksheet()

        self.assertEquals( ws.to_location((1, 2)), (1, 2) )
        self.assertEquals( ws.to_location((1L, 2L)), (1L, 2L) )
        self.assertEquals( ws.to_location(('a', 2)), (1, 2) )
        self.assertEquals( ws.to_location(('A', 2)), (1, 2) )
        self.assertEquals( ws.to_location('a2'), (1, 2) )
        self.assertEquals( ws.to_location('A2'), (1, 2) )

        self.assertEquals( ws.to_location('A'), None )
        self.assertEquals( ws.to_location('1A'), None )
        self.assertEquals( ws.to_location((1, 'A')), None )
        self.assertEquals( ws.to_location(123), None )
        self.assertEquals( ws.to_location(object()), None )
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:17,代码来源:test_worksheet.py

示例2: test_setitem_on_locations_should_reject_non_cell_instances

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_setitem_on_locations_should_reject_non_cell_instances(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(1, 2))

        expected_message_re = "^Worksheet locations must be Cell objects"
        with self.assertRaisesRegexp(TypeError, expected_message_re):
            ws[3, 4] = 123
        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:10,代码来源:test_worksheet.py

示例3: test_getitem_should_use_original_key_if_to_location_gives_none

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_getitem_should_use_original_key_if_to_location_gives_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(3, 4))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
        self.assertEquals(ws.keys(), [(3, 4)])
        self.assertEquals(ws.values()[0].formula, "hello")
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:11,代码来源:test_worksheet.py

示例4: test_getitem_should_use_to_location_result_if_it_is_not_none

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_getitem_should_use_to_location_result_if_it_is_not_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(1, 2))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
        self.assertEquals(ws.keys(), [(1, 2)])
        self.assertEquals(ws.values()[0].formula, "hello")
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:11,代码来源:test_worksheet.py

示例5: test_setitem_on_locations_should_accept_cell_instances

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_setitem_on_locations_should_accept_cell_instances(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(1, 2))
        cell = Cell()

        ws[3, 4] = cell

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
        self.assertEquals(ws.keys(), [(1, 2)])
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:11,代码来源:test_worksheet.py

示例6: test_setitem_on_non_locations_raises_keyerror

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import to_location [as 别名]
    def test_setitem_on_non_locations_raises_keyerror(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=None)

        with self.assertRaisesRegexp(InvalidKeyError, "^'random key' is not a valid cell location$"):
            ws['random key'] = 'sausages'
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:8,代码来源:test_worksheet.py


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