diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-10-20 14:30:48 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-10-20 14:30:48 -0700 |
commit | a415af33dbc390525fa3019d8fbbad03b4079b02 (patch) | |
tree | 848f323b1374e3387125435477bc2928821e2e3b | |
parent | b8859ff5c9bfb139621723c351273a6aa32c1ba1 (diff) | |
download | pystache-a415af33dbc390525fa3019d8fbbad03b4079b02.tar.gz |
Tweak merged patch.
-rw-r--r-- | pystache/tests/test_defaults.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/pystache/tests/test_defaults.py b/pystache/tests/test_defaults.py index 903867a..c78ea7c 100644 --- a/pystache/tests/test_defaults.py +++ b/pystache/tests/test_defaults.py @@ -1,19 +1,28 @@ +# coding: utf-8 + +""" +Unit tests for defaults.py. + +""" + import unittest import pystache -import pystache.defaults from pystache.tests.common import AssertStringMixin -class TestDefaults(unittest.TestCase, AssertStringMixin): - """Set of tests to ensure that the user can override defaults.""" +# TODO: make sure each default has at least one test. +class DefaultsConfigurableTestCase(unittest.TestCase, AssertStringMixin): + """Tests that the user can change the defaults at runtime.""" + + # TODO: switch to using a context manager after 2.4 is deprecated. def setUp(self): - """save all the defaults.""" + """Save the defaults.""" defaults = [ 'DECODE_ERRORS', 'DELIMITERS', - 'FILE_ENCODING', 'MISSING_TAGS', + 'FILE_ENCODING', 'MISSING_TAGS', 'SEARCH_DIRS', 'STRING_ENCODING', 'TAG_ESCAPE', 'TEMPLATE_EXTENSION' ] @@ -26,7 +35,7 @@ class TestDefaults(unittest.TestCase, AssertStringMixin): setattr(pystache.defaults, key, value) def test_tag_escape(self): - """Test that TAG_ESCAPE default takes effect.""" + """Test that changes to defaults.TAG_ESCAPE take effect.""" template = u"{{foo}}" context = {'foo': '<'} actual = pystache.render(template, context) @@ -37,7 +46,7 @@ class TestDefaults(unittest.TestCase, AssertStringMixin): self.assertString(actual, u"<") def test_delimiters(self): - """Test that DELIMITERS default takes effect.""" + """Test that changes to defaults.DELIMITERS take effect.""" template = u"[[foo]]{{foo}}" context = {'foo': 'FOO'} actual = pystache.render(template, context) @@ -48,13 +57,12 @@ class TestDefaults(unittest.TestCase, AssertStringMixin): self.assertString(actual, u"FOO{{foo}}") def test_missing_tags(self): - """Test that MISSING_TAGS default take effect.""" + """Test that changes to defaults.MISSING_TAGS take effect.""" template = u"{{foo}}" context = {} actual = pystache.render(template, context) self.assertString(actual, u"") pystache.defaults.MISSING_TAGS = 'strict' - self.assertRaises(pystache.context.KeyNotFoundError, pystache.render, template, context) |