diff options
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 1327064f..745e5ff4 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -326,7 +326,7 @@ def test_align_text_blank(): fill_char = '-' width = 5 aligned = cu.align_text(text, fill_char=fill_char, width=width, alignment=cu.TextAlignment.LEFT) - assert aligned == text + fill_char * width + assert aligned == fill_char * width def test_align_text_wider_than_width(): text = 'long' @@ -335,6 +335,13 @@ def test_align_text_wider_than_width(): aligned = cu.align_text(text, fill_char=fill_char, width=width, alignment=cu.TextAlignment.LEFT) assert aligned == text +def test_align_text_has_unprintable(): + text = 'foo\x02' + fill_char = '-' + width = 5 + with pytest.raises(ValueError): + cu.align_text(text, fill_char=fill_char, width=width, alignment=cu.TextAlignment.LEFT) + def test_align_text_term_width(): import shutil from cmd2 import ansi |