Esempio n. 1
0
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
Esempio n. 2
0
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
 def visit_entry(self, node):
     if len(node) == 0:
         # Fill single-dot ``.`` for empty table cells
         self.table.add_cell(Cell('.'))
         raise nodes.SkipNode
     else:
         TextTranslator.visit_entry(self, node)
Esempio n. 4
0
def test_table_cell():
    cell = Cell("Foo bar baz")
    cell.wrap(3)
    assert "Cell" in repr(cell)
    assert cell.wrapped == ["Foo", "bar", "baz"]
Esempio n. 5
0
def test_table_cell():
    cell = Cell("Foo bar baz")
    cell.wrap(3)
    assert "Cell" in repr(cell)
    assert cell.wrapped == ["Foo", "bar", "baz"]