def runTest(self): # ARRANGE # root = Element('root') table = Table(TableFormat(first_row_is_header=True), [ [text_cell('ignored'), text_cell('ignored')], [text_cell('ignored'), text_cell('ignored')], ]) # ACT # ret_val = sut.render(ConstantPRenderer('para text'), root, table) # ASSERT # xml_string = as_unicode_str(root) self.assertEqual('<root>' '<table>' '<tr>' '<th>para text</th>' '<th>para text</th>' '</tr>' '<tr>' '<td>para text</td>' '<td>para text</td>' '</tr>' '</table>' '</root>', xml_string) self.assertIs(list(root)[0], ret_val)
def runTest(self): # ARRANGE # root = Element('root') table = Table(TableFormat(first_row_is_header=True), [ [text_cell('ignored'), text_cell('ignored')], [text_cell('ignored'), text_cell('ignored')], ]) # ACT # ret_val = sut.render(ConstantPRenderer('para text'), root, table) # ASSERT # xml_string = as_unicode_str(root) self.assertEqual( '<root>' '<table>' '<tr>' '<th>para text</th>' '<th>para text</th>' '</tr>' '<tr>' '<td>para text</td>' '<td>para text</td>' '</tr>' '</table>' '</root>', xml_string) self.assertIs(list(root)[0], ret_val)
def test_single_empty_row(self): # ARRANGE # root = Element('root') table = Table(TableFormat(), [[]]) # ACT # ret_val = sut.render(ConstantPRenderer('para text'), root, table) # ASSERT # xml_string = as_unicode_str(root) self.assertEqual('<root />', xml_string) self.assertIs(root, ret_val)
def render_table(self, parent: Element, x: Table): return table_rendering.render(self, parent, x)