def test_table_builder(): table = Table([6, 6]) table.add_cell(Cell("foo")) table.add_cell(Cell("bar")) table_str = str(table).split("\n") assert table_str[0] == "+--------+--------+" assert table_str[1] == "| foo | bar |" assert table_str[2] == "+--------+--------+" assert repr(table).count("<Cell ") == 2
def visit_table(self, node): if self.table: raise NotImplementedError('Nested tables are not supported.') self.table = Table() label = "" if len(node['ids']) > 0: label = node['ids'][0] title = "" if isinstance(node.children[0], nodes.title): title = node.children[0].astext() self.new_review_block(u'//table[%s][%s]{' % (label, title))
def test_table_separator(): table = Table([6, 6]) table.add_cell(Cell("foo")) table.add_cell(Cell("bar")) table.set_separator() table.add_row() table.add_cell(Cell("FOO")) table.add_cell(Cell("BAR")) table_str = str(table).split("\n") assert table_str[0] == "+--------+--------+" assert table_str[1] == "| foo | bar |" assert table_str[2] == "|========|========|" assert table_str[3] == "| FOO | BAR |" assert table_str[4] == "+--------+--------+" assert repr(table).count("<Cell ") == 4