本文整理汇总了Python中ezodf.cells.Cell类的典型用法代码示例。如果您正苦于以下问题:Python Cell类的具体用法?Python Cell怎么用?Python Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_replace_display_form
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_error_display_form_for_string
def test_error_display_form_for_string(self):
cell = Cell('cell with string')
with self.assertRaises(TypeError):
cell.display_form = "raise Error"
示例3: test_set_style_name
def test_set_style_name(self):
cell = Cell()
cell.style_name = 'STYLE'
self.assertEqual(cell.style_name, 'STYLE')
self.assertEqual(cell.get_attr(CN('table:style-name')), 'STYLE', 'wrong tag name')
示例4: test_cover_cell
def test_cover_cell(self):
cell = Cell()
cell._set_covered(True)
self.assertTrue(cell.covered)
self.assertEqual(cell.TAG, CoveredCell.TAG)
self.assertEqual('Cell', cell.kind)
示例5: test_init_type_without_value
def test_init_type_without_value(self):
cell = Cell(value_type='float')
self.assertEqual(cell.value_type, 'float')
self.assertEqual(cell.value, None)
self.assertEqual(cell.plaintext(), "")
示例6: test_set_date_value
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')
示例7: test_error_set_invalid_odf_object
def test_error_set_invalid_odf_object(self):
cell = Cell()
with self.assertRaises(ValueError):
cell.set_value(GenericWrapper())
示例8: test_set_currency
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.)
示例9: test_append_text_accept_style_name
def test_append_text_accept_style_name(self):
cell = Cell('Text')
cell.append_text('Text', style_name='test')
self.assertEqual(cell.value, 'TextText')
示例10: test_set_new_string
def test_set_new_string(self):
cell = Cell(value_type='string')
cell.append_text('test')
self.assertEqual(cell.plaintext(), 'test')
self.assertEqual(cell.value, 'test')
示例11: test_check_invalid_value_type
def test_check_invalid_value_type(self):
cell = Cell()
with self.assertRaises(TypeError):
cell.set_value('', value_type='invalid')
示例12: test_set_value_type
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')
示例13: test_check_valid_value_types
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)
示例14: test_set_span
def test_set_span(self):
cell = Cell()
cell._set_span(( 2, 3) )
self.assertEqual(cell.span, (2, 3))
示例15: test_set_protected
def test_set_protected(self):
cell = Cell()
cell.protected = True
self.assertTrue(cell.protected)