From 00388938d2c02922660e63ae163373b25789fafa Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 27 Jun 2019 22:00:10 -0400 Subject: Added fg_lookup() and bg_lookup() two-stage color lookup functions --- tests/test_ansi.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/test_ansi.py') diff --git a/tests/test_ansi.py b/tests/test_ansi.py index 0a48d7f5..b32bdddf 100644 --- a/tests/test_ansi.py +++ b/tests/test_ansi.py @@ -69,3 +69,29 @@ def test_style_color_not_exist(): with pytest.raises(ValueError): ansi.style(base_str, fg='blue', bg='fake') + + +def test_fg_lookup_dict(): + assert ansi.fg_lookup('gray') == Fore.LIGHTBLACK_EX + + +def test_fg_lookup_colorama(): + assert ansi.fg_lookup('green') == Fore.GREEN + + +def test_fg_lookup_nonexist(): + with pytest.raises(ValueError): + ansi.fg_lookup('foo') + + +def test_bg_lookup_dict(): + assert ansi.bg_lookup('gray') == Back.LIGHTBLACK_EX + + +def test_bg_lookup_colorama(): + assert ansi.bg_lookup('green') == Back.GREEN + + +def test_bg_lookup_nonexist(): + with pytest.raises(ValueError): + ansi.bg_lookup('bar') -- cgit v1.2.1