summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Rose <erik@mozilla.com>2011-11-29 12:06:10 -0800
committerErik Rose <erik@mozilla.com>2011-11-29 13:14:41 -0800
commite7665f8209e417bf962e113cb26edc0b6d7e5802 (patch)
tree1e87e881e6571aef1d2d8c7d26ab2aaba04f54e6
parentacb4cc836176e18517ed26ea3a03ece7ee3e6b9a (diff)
downloadblessings-e7665f8209e417bf962e113cb26edc0b6d7e5802.tar.gz
Oops, make the callable color tests valid, and fix on_color().
-rw-r--r--blessings/__init__.py2
-rw-r--r--blessings/tests.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/blessings/__init__.py b/blessings/__init__.py
index 1fde89f..c34ab81 100644
--- a/blessings/__init__.py
+++ b/blessings/__init__.py
@@ -205,7 +205,7 @@ class Terminal(object):
the color and set the formatting to normal afterward.
"""
- return self._resolve_numeric_color(num, self._background_color8)
+ return self._resolve_numeric_color(num, self._background_color)
def _resolve_formatter(self, attr):
"""Resolve a sugary or plain capability name, color, or compound formatting function name into a callable capability."""
diff --git a/blessings/tests.py b/blessings/tests.py
index 83b2ee7..beca0f8 100644
--- a/blessings/tests.py
+++ b/blessings/tests.py
@@ -137,8 +137,10 @@ def test_mnemonic_colors():
def test_callable_numeric_colors():
"""``color(n)`` should return a formatting wrapper."""
t = TestTerminal()
+ eq_(t.color(5)('smoo'), t.magenta + 'smoo' + t.normal)
eq_(t.color(5)('smoo'), t.color(5) + 'smoo' + t.normal)
- eq_(t.on_color(6)('smoo'), t.on_color(6) + 'smoo' + t.normal)
+ eq_(t.on_color(2)('smoo'), t.on_green + 'smoo' + t.normal)
+ eq_(t.on_color(2)('smoo'), t.on_color(2) + 'smoo' + t.normal)
def test_null_callable_numeric_colors():