예제 #1
0
def test_painter_enabled_does_not_output_colors_when_manually_disabled():
    paint.enabled = False
    assert paint.red('foo') == 'foo'
    paint.enabled = True
예제 #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'
예제 #3
0
def test_painter_doesnt_output_escape_codes_if_the_input_is_empty():
    assert paint.red() == ''
예제 #4
0
def test_painter_support_variable_number_of_arguments():
    assert paint.red('foo', 'bar') == '\x1b[31mfoo bar\x1b[39m'
예제 #5
0
def test_painter_support_falsy_values():
    assert paint.red(0) == '\x1b[31m0\x1b[39m'
예제 #6
0
def test_painter_enabled_does_not_output_colors_when_manually_disabled():
    paint.enabled = False
    assert paint.red('foo') == 'foo'
    paint.enabled = True
예제 #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')
예제 #8
0
def test_painter_doesnt_output_escape_codes_if_the_input_is_empty():
    assert paint.red() == ''
예제 #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'
예제 #10
0
def test_painter_support_falsy_values():
    assert paint.red(0) == '\x1b[31m0\x1b[39m'
예제 #11
0
def test_painter_support_variable_number_of_arguments():
    assert paint.red('foo', 'bar') == '\x1b[31mfoo bar\x1b[39m'
예제 #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'
    )