def test_painter_enabled_does_not_output_colors_when_manually_disabled(): paint.enabled = False assert paint.red('foo') == 'foo' paint.enabled = True
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'
def test_painter_doesnt_output_escape_codes_if_the_input_is_empty(): assert paint.red() == ''
def test_painter_support_variable_number_of_arguments(): assert paint.red('foo', 'bar') == '\x1b[31mfoo bar\x1b[39m'
def test_painter_support_falsy_values(): assert paint.red(0) == '\x1b[31m0\x1b[39m'
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')
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' )