summaryrefslogtreecommitdiff
path: root/blessings/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'blessings/tests.py')
-rw-r--r--blessings/tests.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/blessings/tests.py b/blessings/tests.py
index 7dda746..a61b73e 100644
--- a/blessings/tests.py
+++ b/blessings/tests.py
@@ -137,23 +137,23 @@ def test_null_fileno():
def test_mnemonic_colors():
"""Make sure color shortcuts work."""
- def color(num):
- return unicode_parm('setaf', num)
+ def color(t, num):
+ return t.number_of_colors and unicode_parm('setaf', num) or ''
- def on_color(num):
- return unicode_parm('setab', num)
+ def on_color(t, num):
+ return t.number_of_colors and unicode_parm('setab', num) or ''
# Avoid testing red, blue, yellow, and cyan, since they might someday
# change depending on terminal type.
t = TestTerminal()
- eq_(t.white, color(7))
- eq_(t.green, color(2)) # Make sure it's different than white.
- eq_(t.on_black, on_color(0))
- eq_(t.on_green, on_color(2))
- eq_(t.bright_black, color(8))
- eq_(t.bright_green, color(10))
- eq_(t.on_bright_black, on_color(8))
- eq_(t.on_bright_green, on_color(10))
+ eq_(t.white, color(t, 7))
+ eq_(t.green, color(t, 2)) # Make sure it's different than white.
+ eq_(t.on_black, on_color(t, 0))
+ eq_(t.on_green, on_color(t, 2))
+ eq_(t.bright_black, color(t, 8))
+ eq_(t.bright_green, color(t, 10))
+ eq_(t.on_bright_black, on_color(t, 8))
+ eq_(t.on_bright_green, on_color(t, 10))
def test_callable_numeric_colors():