本文整理汇总了Python中dirigible.sheet.worksheet.Worksheet.keys方法的典型用法代码示例。如果您正苦于以下问题:Python Worksheet.keys方法的具体用法?Python Worksheet.keys怎么用?Python Worksheet.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dirigible.sheet.worksheet.Worksheet
的用法示例。
在下文中一共展示了Worksheet.keys方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_constant
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_constant(self):
worksheet = Worksheet()
worksheet[1, 2].formula = '3'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', ''), sentinel.private_key)
self.assertEquals(worksheet.keys(), [(1, 2)])
self.assertEquals(worksheet[(1, 2)].formula, '3')
self.assertEquals(worksheet[(1, 2)].value, 3)
示例2: test_getitem_should_use_original_key_if_to_location_gives_none
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [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")
示例3: 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 keys [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")
示例4: test_setitem_on_locations_should_accept_cell_instances
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [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)])
示例5: test_postformula_usercode
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_postformula_usercode(self):
worksheet = Worksheet()
worksheet[1, 1].formula = '=1'
postformula_usercode = 'worksheet[1, 2].value = worksheet[1, 1].value + 1'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', postformula_usercode), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 1), (1, 2)]))
self.assertEquals(worksheet[1, 1].value, 1)
self.assertEquals(worksheet[1, 2].value, 2)
self.assertEquals(worksheet[1, 1].formula, '=1')
self.assertEquals(worksheet[1, 2].formula, None)
示例6: test_python_formulae
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_python_formulae(self):
worksheet = Worksheet()
worksheet[1, 1].python_formula = '1'
worksheet[1, 2].python_formula = '2'
worksheet[1, 3].python_formula = '1 + 2'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 1), (1, 2), (1, 3)]))
self.assertEquals(worksheet[1, 1].value, 1)
self.assertEquals(worksheet[1, 2].value, 2)
self.assertEquals(worksheet[1, 3].value, 3)
示例7: test_multiple_constants
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_multiple_constants(self):
worksheet = Worksheet()
worksheet[1, 2].formula = '3'
worksheet[3, 4].formula = '4+5'
worksheet[2, 5].formula = 'blurgle'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 2), (3, 4), (2, 5)]))
self.assertEquals(worksheet[1, 2].formula, '3')
self.assertEquals(worksheet[3, 4].formula, '4+5')
self.assertEquals(worksheet[2, 5].formula, 'blurgle')
self.assertEquals(worksheet[1, 2].value, 3)
self.assertEquals(worksheet[3, 4].value, '4+5')
self.assertEquals(worksheet[2, 5].value, 'blurgle')
示例8: test_preformula_usercode
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_preformula_usercode(self):
worksheet = Worksheet()
worksheet[1, 1].formula = '3'
worksheet[1, 3].formula = '=A2 + 1'
preformula_usercode = "worksheet[1, 2].value = worksheet[1, 1].value + 1"
calculate(worksheet, SANITY_CHECK_USERCODE % (preformula_usercode, ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 1), (1, 2), (1, 3)]))
self.assertEquals(worksheet[1, 1].value, 3)
self.assertEquals(worksheet[1, 2].value, 4)
self.assertEquals(worksheet[1, 3].value, 5)
self.assertEquals(worksheet[1, 1].formula, '3')
self.assertEquals(worksheet[1, 2].formula, None)
self.assertEquals(worksheet[1, 3].formula, '=A2 + 1')
示例9: test_arithmetic
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_arithmetic(self):
worksheet = Worksheet()
worksheet[1, 2].formula = '=3'
worksheet[3, 4].formula = '=4+5'
worksheet[4, 4].formula = '=1/10'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 2), (3, 4), (4, 4)]))
self.assertEquals(worksheet[1, 2].value, 3)
self.assertEquals(worksheet[3, 4].value, 9)
self.assertEquals(worksheet[4, 4].value, 0.1)
self.assertEquals(worksheet[1, 2].formula, '=3')
self.assertEquals(worksheet[3, 4].formula, '=4+5')
self.assertEquals(worksheet[4, 4].formula, '=1/10')
示例10: test_preformula_usercode_functions
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_preformula_usercode_functions(self):
worksheet = Worksheet()
worksheet[1, 1].formula = '1'
worksheet[1, 2].formula = '=foo(3)'
preformula_usercode = dedent('''
def foo(value):
return worksheet[1, 1].value + value
''')
calculate(worksheet, SANITY_CHECK_USERCODE % (preformula_usercode, ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 1), (1, 2)]))
self.assertEquals(worksheet[1, 1].value, 1)
self.assertEquals(worksheet[1, 2].value, 4)
self.assertEquals(worksheet[1, 1].formula, '1')
self.assertEquals(worksheet[1, 2].formula, '=foo(3)')
示例11: test_formulae
# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import keys [as 别名]
def test_formulae(self):
worksheet = Worksheet()
worksheet[1, 1].formula = '=1'
worksheet[1, 2].formula = '=2'
worksheet[1, 3].formula = '=A1 + A2'
worksheet[1, 4].formula = '=DateTime(2000, 1, 2, 3, 4, 5)'
calculate(worksheet, SANITY_CHECK_USERCODE % ('', ''), sentinel.private_key)
self.assertEquals(set(worksheet.keys()), set([(1, 1), (1, 2), (1, 3), (1, 4)]))
self.assertEquals(worksheet[1, 1].value, 1)
self.assertEquals(worksheet[1, 2].value, 2)
self.assertEquals(worksheet[1, 3].value, 3)
self.assertEquals(worksheet[1, 4].value, datetime(2000, 1, 2, 3, 4, 5))
self.assertEquals(worksheet[1, 1].formula, '=1')
self.assertEquals(worksheet[1, 2].formula, '=2')
self.assertEquals(worksheet[1, 3].formula, '=A1 + A2')
self.assertEquals(worksheet[1, 4].formula, '=DateTime(2000, 1, 2, 3, 4, 5)')