summaryrefslogtreecommitdiff
path: root/tests/test_ansi.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2020-02-06 21:28:06 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2020-02-06 21:28:06 -0500
commitede9f3e77a59281a442227ed9b4b92e62e85d2b9 (patch)
treeb87239799cf71c67704d3ffe7bc0879d57056d3e /tests/test_ansi.py
parentc7ac2e965d025806ce5baddfc718814e3e58d639 (diff)
downloadcmd2-git-ede9f3e77a59281a442227ed9b4b92e62e85d2b9.tar.gz
Added convenience `ansi.fg` and `ansi.bg` enums of foreground and background colors which style() can now optionally use
This is to make it easier to autocomplete color names in an IDE
Diffstat (limited to 'tests/test_ansi.py')
-rw-r--r--tests/test_ansi.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_ansi.py b/tests/test_ansi.py
index cb68cb28..f711fc1a 100644
--- a/tests/test_ansi.py
+++ b/tests/test_ansi.py
@@ -119,3 +119,17 @@ def test_async_alert_str(cols, prompt, line, cursor, msg, expected):
alert_str = ansi.async_alert_str(terminal_columns=cols, prompt=prompt, line=line, cursor_offset=cursor,
alert_msg=msg)
assert alert_str == expected
+
+
+def test_fg_enum():
+ assert ansi.fg_lookup('bright_red') == ansi.fg_lookup(ansi.fg.bright_red)
+
+def test_fg_enum_to_str():
+ assert str(ansi.fg.black) == ansi.fg_lookup('black')
+
+def test_bg_enum():
+ assert ansi.bg_lookup('green') == ansi.bg_lookup(ansi.bg.green)
+
+def test_bg_enum_to_str():
+ assert str(ansi.bg.blue) == ansi.bg_lookup('blue')
+