Ejemplo n.º 1
0
def test_painter_enabled_does_not_output_colors_when_manually_disabled():
    paint.enabled = False
    assert paint.red('foo') == 'foo'
    paint.enabled = True
Ejemplo n.º 2
0
def test_painter_style_string():
    assert paint.underline('foo') == '\x1b[4mfoo\x1b[24m'
    assert paint.red('foo') == '\x1b[31mfoo\x1b[39m'
    assert paint.on_red('foo') == '\x1b[41mfoo\x1b[49m'
Ejemplo n.º 3
0
def test_painter_doesnt_output_escape_codes_if_the_input_is_empty():
    assert paint.red() == ''
Ejemplo n.º 4
0
def test_painter_support_variable_number_of_arguments():
    assert paint.red('foo', 'bar') == '\x1b[31mfoo bar\x1b[39m'
Ejemplo n.º 5
0
def test_painter_support_falsy_values():
    assert paint.red(0) == '\x1b[31m0\x1b[39m'
Ejemplo n.º 6
0
def test_painter_enabled_does_not_output_colors_when_manually_disabled():
    paint.enabled = False
    assert paint.red('foo') == 'foo'
    paint.enabled = True
Ejemplo n.º 7
0
def test_painter_support_nesting_styles():
    assert paint.red('foo' + paint.underline.on_blue('bar') + '!') == (
        '\x1b[31mfoo\x1b[44m\x1b[4mbar\x1b[24m\x1b[49m!\x1b[39m')
Ejemplo n.º 8
0
def test_painter_doesnt_output_escape_codes_if_the_input_is_empty():
    assert paint.red() == ''
Ejemplo n.º 9
0
def test_painter_style_string():
    assert paint.underline('foo') == '\x1b[4mfoo\x1b[24m'
    assert paint.red('foo') == '\x1b[31mfoo\x1b[39m'
    assert paint.on_red('foo') == '\x1b[41mfoo\x1b[49m'
Ejemplo n.º 10
0
def test_painter_support_falsy_values():
    assert paint.red(0) == '\x1b[31m0\x1b[39m'
Ejemplo n.º 11
0
def test_painter_support_variable_number_of_arguments():
    assert paint.red('foo', 'bar') == '\x1b[31mfoo bar\x1b[39m'
Ejemplo n.º 12
0
def test_painter_support_nesting_styles():
    assert paint.red('foo' + paint.underline.on_blue('bar') + '!') == (
        '\x1b[31mfoo\x1b[44m\x1b[4mbar\x1b[24m\x1b[49m!\x1b[39m'
    )