diff options
author | Erik Rose <erik@mozilla.com> | 2011-11-29 00:23:22 -0800 |
---|---|---|
committer | Erik Rose <erik@mozilla.com> | 2011-11-29 00:25:36 -0800 |
commit | cd8fbd9d04db72aa74c33647730c142eda92286e (patch) | |
tree | 3f22c67cb71fe5f04724cf29352ccfba6b448da1 /blessings/tests.py | |
parent | 1636543bdaaa11cc27f6fb06a6787c7145860544 (diff) | |
download | blessings-cd8fbd9d04db72aa74c33647730c142eda92286e.tar.gz |
Make `color(n)` callable to wrap a string, like the named colors can. Bump version to 1.3. Closes #12.
Diffstat (limited to 'blessings/tests.py')
-rw-r--r-- | blessings/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/blessings/tests.py b/blessings/tests.py index 8690f4d..83b2ee7 100644 --- a/blessings/tests.py +++ b/blessings/tests.py @@ -134,6 +134,20 @@ def test_mnemonic_colors(): eq_(t.on_bright_green, on_color(10)) +def test_callable_numeric_colors(): + """``color(n)`` should return a formatting wrapper.""" + t = TestTerminal() + eq_(t.color(5)('smoo'), t.color(5) + 'smoo' + t.normal) + eq_(t.on_color(6)('smoo'), t.on_color(6) + 'smoo' + t.normal) + + +def test_null_callable_numeric_colors(): + """``color(n)`` should be a no-op on null terminals.""" + t = TestTerminal(stream=StringIO()) + eq_(t.color(5)('smoo'), 'smoo') + eq_(t.on_color(6)('smoo'), 'smoo') + + def test_formatting_functions(): """Test crazy-ass formatting wrappers, both simple and compound.""" t = TestTerminal() |