summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-26 10:36:24 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-26 10:36:24 -0400
commit72044030810dd293699a6bae8853e1cfd0b4887b (patch)
treef389fd97625c55e161cf04ac7e879422a2b19e9a /tests
parente34bba44ef53228aeba613ac6e928b2c315111cf (diff)
downloadcmd2-git-72044030810dd293699a6bae8853e1cfd0b4887b.tar.gz
Added TextStyle class and default implementations for various message types like Warning, Error, and Succes
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py4
-rw-r--r--tests/test_utils.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 3b6089f4..80077a68 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1460,7 +1460,7 @@ def test_poutput_none(outsim_app):
def test_poutput_color_always(outsim_app):
msg = 'Hello World'
outsim_app.colors = 'Always'
- outsim_app.poutput(ansi.style(msg, fg='cyan'))
+ outsim_app.poutput(ansi.style(msg, ansi.TextStyle(fg='cyan')))
out = outsim_app.stdout.getvalue()
expected = Fore.CYAN + msg + Fore.RESET + '\n'
assert out == expected
@@ -1468,7 +1468,7 @@ def test_poutput_color_always(outsim_app):
def test_poutput_color_never(outsim_app):
msg = 'Hello World'
outsim_app.colors = 'Never'
- outsim_app.poutput(ansi.style(msg, fg='cyan'))
+ outsim_app.poutput(ansi.style(msg, ansi.TextStyle(fg='cyan')))
out = outsim_app.stdout.getvalue()
expected = msg + '\n'
assert out == expected
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 88eb0901..6e3600db 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -29,18 +29,18 @@ def test_ansi_safe_wcswidth():
def test_style():
base_str = HELLO_WORLD
ansi_str = Fore.BLUE + Back.GREEN + base_str + Fore.RESET + Back.RESET
- assert ansi.style(base_str, fg='blue', bg='green') == ansi_str
+ assert ansi.style(base_str, ansi.TextStyle(fg='blue', bg='green')) == ansi_str
def test_style_color_not_exist():
base_str = HELLO_WORLD
try:
- ansi.style(base_str, fg='hello', bg='green')
+ ansi.style(base_str, ansi.TextStyle(fg='fake', bg='green'))
assert False
except ValueError:
assert True
try:
- ansi.style(base_str, fg='blue', bg='hello')
+ ansi.style(base_str, ansi.TextStyle(fg='blue', bg='fake'))
assert False
except ValueError:
assert True