diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-24 11:13:42 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-24 11:13:42 -0400 |
commit | a2ad70bd79a78123d2bb67b1ff1ed0b815dd721d (patch) | |
tree | 22059fc991a5e3ff3b0cc4b4cfc2015efd9dcf41 /tests/test_cmd2.py | |
parent | 806fe461acee59bcda791a9cb9ebf396af80126e (diff) | |
download | cmd2-git-a2ad70bd79a78123d2bb67b1ff1ed0b815dd721d.tar.gz |
Added optional color argument to poutput() for providing a color escape code to colorize the output with
Also:
- Added optional err_color and war_color arguments to perror() for providing color escape codes
- Removed usage of deprecated colorize() method within the examples
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 8c8787af..9cb869bd 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1094,18 +1094,19 @@ def test_ansi_prompt_not_esacped(base_app): def test_ansi_prompt_escaped(): + from colorama import Fore app = cmd2.Cmd() - color = 'cyan' + color = Fore.CYAN prompt = 'InColor' - color_prompt = app.colorize(prompt, color) + color_prompt = color + prompt + Fore.RESET readline_hack_start = "\x01" readline_hack_end = "\x02" readline_safe_prompt = app._surround_ansi_escapes(color_prompt) assert prompt != color_prompt - assert readline_safe_prompt.startswith(readline_hack_start + app._colorcodes[color][True] + readline_hack_end) - assert readline_safe_prompt.endswith(readline_hack_start + app._colorcodes[color][False] + readline_hack_end) + assert readline_safe_prompt.startswith(readline_hack_start + color + readline_hack_end) + assert readline_safe_prompt.endswith(readline_hack_start + Fore.RESET + readline_hack_end) class HelpApp(cmd2.Cmd): |