summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2021-10-27 12:10:45 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2021-10-27 12:10:45 -0400
commitd2c97338d395f4ce2439cf6ccde0aabac413d959 (patch)
tree1a898cd927629345a948955c6b453147e6acffcf /tests
parent0d60017ba650ce2c8eedf2de7317477292e80056 (diff)
downloadcmd2-git-d2c97338d395f4ce2439cf6ccde0aabac413d959.tar.gz
Added type checks to ansi.style()
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ansi.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_ansi.py b/tests/test_ansi.py
index d94fd91a..bed60eab 100644
--- a/tests/test_ansi.py
+++ b/tests/test_ansi.py
@@ -58,6 +58,17 @@ def test_style_bg(bg_color):
assert ansi.style(base_str, bg=bg_color) == ansi_str
+# noinspection PyTypeChecker
+def test_style_invalid_types():
+ # Use a BgColor with fg
+ with pytest.raises(TypeError):
+ ansi.style('test', fg=ansi.Bg.BLUE)
+
+ # Use a FgColor with bg
+ with pytest.raises(TypeError):
+ ansi.style('test', bg=ansi.Fg.BLUE)
+
+
def test_style_bold():
base_str = HELLO_WORLD
ansi_str = ansi.TextStyle.INTENSITY_BOLD + base_str + ansi.TextStyle.INTENSITY_NORMAL
@@ -236,7 +247,6 @@ def test_sequence_str_building(ansi_sequence):
],
)
def test_rgb_bounds(r, g, b, valid):
-
if valid:
ansi.RgbFg(r, g, b)
ansi.RgbBg(r, g, b)