def test_fg_lookup_nonexist(): with pytest.raises(ValueError): ansi.fg_lookup('foo')
def test_fg_lookup_exist(): fg_color = 'green' assert ansi.fg_lookup(fg_color) == ansi.FG_COLORS[fg_color]
class Matching(ansi.ColorBase): magenta = ansi.fg_lookup('magenta') purple = ansi.fg_lookup('magenta')
def test_color_enum(): assert ansi.fg_lookup('bright_red') == ansi.fg_lookup(ansi.fg.bright_red) assert ansi.bg_lookup('green') == ansi.bg_lookup(ansi.bg.green)
def test_fg_lookup_exist(): fg_color = 'green' assert ansi.fg_lookup(fg_color) == ansi.fg_lookup(ansi.fg.green)