summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-27 22:00:10 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-27 22:00:10 -0400
commit00388938d2c02922660e63ae163373b25789fafa (patch)
treebc06279f1fc0ef59de119fcaae68d460aa40e74a /tests
parent2721f8a619ca4e5447a4507658f09d3ba4e10a14 (diff)
downloadcmd2-git-00388938d2c02922660e63ae163373b25789fafa.tar.gz
Added fg_lookup() and bg_lookup() two-stage color lookup functions
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ansi.py26
1 files changed, 26 insertions, 0 deletions
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')