From e7665f8209e417bf962e113cb26edc0b6d7e5802 Mon Sep 17 00:00:00 2001 From: Erik Rose Date: Tue, 29 Nov 2011 12:06:10 -0800 Subject: Oops, make the callable color tests valid, and fix on_color(). --- blessings/__init__.py | 2 +- blessings/tests.py | 4 +++- 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(): -- cgit v1.2.1