summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_cmd2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 452d37dc..a663c164 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -342,3 +342,15 @@ now: True
run_cmd(base_app, 'load does_not_exist.txt')
out, err = capsys.readouterr()
assert str(err).startswith('Traceback (most recent call last):')
+
+
+def test_base_colorize(base_app):
+ # If using base_app test fixture it won't get colorized because we replaced self.stdout
+ color_test = base_app.colorize('Test', 'red')
+ assert color_test == 'Test'
+
+ # But if we create a fresh Cmd() instance, it will
+ fresh_app = cmd2.Cmd()
+ color_test = fresh_app.colorize('Test', 'red')
+ assert color_test == '\x1b[31mTest\x1b[39m'
+