Esempio n. 1
0
def test_print_table(capsys):
    tty.reinit()
    tty.print_table(["foo", "bar"], ["", ""],
                    [["Guildo", "Horn"], ["Dieter Thomas", "Kuhn"]])  #
    captured = capsys.readouterr()
    assert captured.out == ("foo           bar \n"
                            "------------- ----\n"
                            "Guildo        Horn\n"
                            "Dieter Thomas Kuhn\n")
    assert captured.err == ""
Esempio n. 2
0
def test_print_colored_table(capsys):
    tty.reinit()
    tty.print_table(["foo", "bar"], ["XX", "YY"],
                    [["Angus", "Young"], ["Estas", "Tonne"]])  #
    captured = capsys.readouterr()
    assert captured.out == ("XXfoo  YY bar  \n"
                            "XX-----YY -----\n"
                            "XXAngusYY Young\n"
                            "XXEstasYY Tonne\n")
    assert captured.err == ""
Esempio n. 3
0
def test_print_table(capsys):
    tty.reinit()
    tty.print_table(
        ['foo', 'bar'],  #
        ['', ''],
        [['Guildo', 'Horn'], ['Dieter Thomas', 'Kuhn']])
    captured = capsys.readouterr()
    assert captured.out == ('foo           bar \n'
                            '------------- ----\n'
                            'Guildo        Horn\n'
                            'Dieter Thomas Kuhn\n')
    assert captured.err == ''
Esempio n. 4
0
def test_print_colored_table(capsys):
    tty.reinit()
    tty.print_table(
        ['foo', 'bar'],  #
        ['XX', 'YY'],
        [['Angus', 'Young'], ['Estas', 'Tonne']])
    captured = capsys.readouterr()
    assert captured.out == ('XXfoo  YY bar  \n'
                            'XX-----YY -----\n'
                            'XXAngusYY Young\n'
                            'XXEstasYY Tonne\n')
    assert captured.err == ''
Esempio n. 5
0
def test_print_indented_colored_table(capsys):
    tty.reinit()
    tty.print_table(
        ['foo', 'bar'],  #
        ['XX', 'YY'],
        [['Dieter', 'Bohlen'], ['Thomas', 'Anders']],
        indent='====')
    captured = capsys.readouterr()
    assert captured.out == ('====XXfoo   YY bar   \n'
                            '====XX------YY ------\n'
                            '====XXDieterYY Bohlen\n'
                            '====XXThomasYY Anders\n')
    assert captured.err == ''
Esempio n. 6
0
def test_print_indented_colored_table(capsys):
    tty.reinit()
    tty.print_table(
        ["foo", "bar"],
        ["XX", "YY"],
        [["Dieter", "Bohlen"], ["Thomas", "Anders"]],
        indent="===="  #
    )
    captured = capsys.readouterr()
    assert captured.out == ("====XXfoo   YY bar   \n"
                            "====XX------YY ------\n"
                            "====XXDieterYY Bohlen\n"
                            "====XXThomasYY Anders\n")
    assert captured.err == ""