本文整理汇总了Python中ezodf.cells.Cell.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python Cell.set_value方法的具体用法?Python Cell.set_value怎么用?Python Cell.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezodf.cells.Cell
的用法示例。
在下文中一共展示了Cell.set_value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_replace_display_form
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_replace_display_form(self):
cell = Cell()
cell.set_value(100.)
cell.display_form = "100,00"
self.assertEqual(cell.plaintext(), "100,00")
cell.display_form = "200,00"
self.assertEqual(cell.plaintext(), "200,00")
示例2: test_set_date_value
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_date_value(self):
cell = Cell()
cell.set_value('2011-01-29T12:00:00', 'date')
self.assertEqual(cell.value_type, 'date')
self.assertEqual(cell.value, '2011-01-29T12:00:00')
示例3: test_set_time_value
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_time_value(self):
cell = Cell()
cell.set_value('PT0H05M00,0000S', 'time')
self.assertEqual(cell.value_type, 'time')
self.assertEqual(cell.value, 'PT0H05M00,0000S')
示例4: test_error_set_invalid_odf_object
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_error_set_invalid_odf_object(self):
cell = Cell()
with self.assertRaises(ValueError):
cell.set_value(GenericWrapper())
示例5: test_error_set_None_value
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_error_set_None_value(self):
cell = Cell()
with self.assertRaises(ValueError):
cell.set_value(None)
示例6: test_set_currency
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_currency(self):
cell = Cell()
cell.set_value(100., currency='EUR')
self.assertEqual(cell.currency, 'EUR')
self.assertEqual(cell.value_type, 'currency')
self.assertEqual(cell.value, 100.)
示例7: test_set_false_boolean_without_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_false_boolean_without_type(self):
cell = Cell()
cell.set_value(False)
self.assertEqual(cell.value_type, 'boolean')
self.assertEqual(cell.value, False)
示例8: test_set_true_boolean_with_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_true_boolean_with_type(self):
cell = Cell()
cell.set_value(True, 'boolean')
self.assertEqual(cell.value_type, 'boolean')
self.assertEqual(cell.value, True)
示例9: test_set_int_without_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_int_without_type(self):
cell = Cell()
cell.set_value(100)
self.assertEqual(cell.value_type, 'float')
self.assertEqual(cell.value, 100.)
示例10: test_set_float_without_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_float_without_type(self):
cell = Cell()
# set type explicit else type is string
cell.set_value(100.)
self.assertEqual(cell.value_type, 'float')
self.assertEqual(cell.value, 100.0)
示例11: test_set_float_with_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_float_with_type(self):
cell = Cell()
cell.set_value('100', 'float')
self.assertEqual(cell.value_type, 'float')
self.assertEqual(cell.value, 100.)
示例12: test_replace_two_paragraphs_by_new_string
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_replace_two_paragraphs_by_new_string(self):
cell = Cell('test1')
cell.append(Paragraph('test2'))
cell.set_value('new content')
self.assertEqual('new content', cell.value)
示例13: test_check_invalid_value_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_check_invalid_value_type(self):
cell = Cell()
with self.assertRaises(TypeError):
cell.set_value('', value_type='invalid')
示例14: test_set_value_type
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_set_value_type(self):
cell = Cell()
cell.set_value('a string')
self.assertEqual(cell.value_type, 'string')
self.assertEqual(cell.get_attr(CN('office:value-type')), 'string',
'wrong tag name')
示例15: test_check_valid_value_types
# 需要导入模块: from ezodf.cells import Cell [as 别名]
# 或者: from ezodf.cells.Cell import set_value [as 别名]
def test_check_valid_value_types(self):
cell = Cell()
for t in ('float', 'percentage', 'currency', 'date', 'time', 'boolean', 'string'):
cell.set_value(1., t)
self.assertEqual(cell.value_type, t)