From ede9f3e77a59281a442227ed9b4b92e62e85d2b9 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 6 Feb 2020 21:28:06 -0500 Subject: 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 --- tests/test_ansi.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/test_ansi.py') 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') + -- cgit v1.2.1