Пример #1
0
    def table(self, header=None, rows=None, style=None):
        """
        Return a Table instance.
        """
        if style is not None:
            style = self.TABLE_STYLES[style]

        table = Table(style)

        if header:
            table.set_header_row(header)

        if rows:
            table.set_rows(rows)

        return table
Пример #2
0
    def table(self, header=None, rows=None, style=None):
        """
        Return a Table instance.
        """
        if style is not None:
            style = self.TABLE_STYLES[style]

        table = Table(style)

        if header:
            table.set_header_row(header)

        if rows:
            table.set_rows(rows)

        return table
Пример #3
0
def test_set_rows(io):
    table = Table()

    table.set_rows([["a", "b", "c"], ["d", "e", "f"]])

    table.render(io)

    table.set_row(1, ["g", "h", "i"])

    table.render(io)

    expected = """\
+---+---+---+
| a | b | c |
| d | e | f |
+---+---+---+
+---+---+---+
| a | b | c |
| g | h | i |
+---+---+---+
"""

    assert expected == io.fetch_output()