diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-11 17:13:43 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-11 17:13:43 -0500 |
commit | 0873b4d280f1335041ced7ba336768761ebb2a5f (patch) | |
tree | 30be9d6b819bee3e02b4f060675e2a86256e0aca /tests | |
parent | f72e1dded0294dbf2566da6510d35ee846fd0b13 (diff) | |
download | cmd2-git-0873b4d280f1335041ced7ba336768761ebb2a5f.tar.gz |
Allowing for colored fill char in align_text
Added function to index all style sequences found in a string
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index db432286..7546184e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -368,6 +368,15 @@ def test_align_text_fill_char_is_tab(): aligned = cu.align_text(text, cu.TextAlignment.LEFT, fill_char=fill_char, width=width) assert aligned == text + ' ' +def test_align_text_fill_char_has_color(): + from cmd2 import ansi + + text = 'foo' + fill_char = ansi.fg.bright_yellow + '-' + ansi.fg.reset + width = 5 + aligned = cu.align_text(text, cu.TextAlignment.LEFT, fill_char=fill_char, width=width) + assert aligned == text + fill_char * 2 + def test_align_text_width_is_too_small(): text = 'foo' fill_char = '-' @@ -382,7 +391,7 @@ def test_align_text_fill_char_is_too_long(): with pytest.raises(TypeError): cu.align_text(text, cu.TextAlignment.LEFT, fill_char=fill_char, width=width) -def test_align_text_fill_char_is_unprintable(): +def test_align_text_fill_char_is_newline(): text = 'foo' fill_char = '\n' width = 5 |