diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-10-27 12:10:45 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-10-27 12:10:45 -0400 |
| commit | d2c97338d395f4ce2439cf6ccde0aabac413d959 (patch) | |
| tree | 1a898cd927629345a948955c6b453147e6acffcf /tests | |
| parent | 0d60017ba650ce2c8eedf2de7317477292e80056 (diff) | |
| download | cmd2-git-d2c97338d395f4ce2439cf6ccde0aabac413d959.tar.gz | |
Added type checks to ansi.style()
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_ansi.py | 12 |
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) |
