本文整理匯總了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)