Пример #1
0
def test_update_line():
    for i in reversed(range(101)):
        line = get_line('123%d' % i, update_line=True)
        expected = '\x1b[2K\r%s%d\x1b[0m' % ('123', i)
        assert line == expected
Пример #2
0
def test_get_color():
    result = get_line('123 light green', color=Color.LightGreen)
    expected = '\x1b[1;32m123 light green\x1b[0m'
    assert result == expected
Пример #3
0
def test_get_bgcolor():
    result = get_line('123 green bg', bgcolor=BgColor.Green)
    expected = '\x1b[42;1m123 green bg\x1b[0m'
    assert result == expected
Пример #4
0
def test_print_underline():
    result = get_line('123 underline', underline=True)
    expected = '\x1b[4m123 underline\x1b[0m'
    assert result == expected
Пример #5
0
def test_print_bold():
    result = get_line('123 bold', bold=True)
    expected = '\x1b[1m123 bold\x1b[0m'
    assert result == expected
Пример #6
0
def test_color_and_bgcolor():
    result = get_line('1', bgcolor=BgColor.Green, color=Color.Red)
    expected = '\x1b[0;31m\x1b[42;1m1\x1b[0m'
    assert result == expected