diff options
author | Ben Leslie <benno@benno.id.au> | 2012-09-19 07:57:32 +1000 |
---|---|---|
committer | Ben Leslie <benno@benno.id.au> | 2012-09-19 07:57:32 +1000 |
commit | d0c65dd9aefa432bc056a78f204474ddc7b5fb04 (patch) | |
tree | e2506fc187827ea79baa604eebec8521ac37333e | |
parent | 353da3daf5a918c9862fe58b6b403d20d99ed2ff (diff) | |
download | pystache-d0c65dd9aefa432bc056a78f204474ddc7b5fb04.tar.gz |
Improve patch based on pull request feedback
Replace 'config' with 'context'.
Use assertRaises correctly.
-rw-r--r-- | pystache/tests/test_defaults.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/pystache/tests/test_defaults.py b/pystache/tests/test_defaults.py index cbb68e7..903867a 100644 --- a/pystache/tests/test_defaults.py +++ b/pystache/tests/test_defaults.py @@ -28,41 +28,33 @@ class TestDefaults(unittest.TestCase, AssertStringMixin): def test_tag_escape(self): """Test that TAG_ESCAPE default takes effect.""" template = u"{{foo}}" - config = {'foo': '<'} - actual = pystache.render(template, config) + context = {'foo': '<'} + actual = pystache.render(template, context) self.assertString(actual, u"<") pystache.defaults.TAG_ESCAPE = lambda u: u - actual = pystache.render(template, config) + actual = pystache.render(template, context) self.assertString(actual, u"<") def test_delimiters(self): """Test that DELIMITERS default takes effect.""" template = u"[[foo]]{{foo}}" - config = {'foo': 'FOO'} - actual = pystache.render(template, config) + context = {'foo': 'FOO'} + actual = pystache.render(template, context) self.assertString(actual, u"[[foo]]FOO") pystache.defaults.DELIMITERS = ('[[', ']]') - actual = pystache.render(template, config) + actual = pystache.render(template, context) self.assertString(actual, u"FOO{{foo}}") def test_missing_tags(self): """Test that MISSING_TAGS default take effect.""" template = u"{{foo}}" - config = {} - actual = pystache.render(template, config) + context = {} + actual = pystache.render(template, context) self.assertString(actual, u"") pystache.defaults.MISSING_TAGS = 'strict' - # In theory this should work, but for some reason doesn't, - # instead another exception is raised - # self.assertRaises(pystache.context.KeyNotFoundError, - # pystache.render, (template, config)) - try: - pystache.render(template, config) - except pystache.context.KeyNotFoundError, e: - return - - self.fail() + self.assertRaises(pystache.context.KeyNotFoundError, + pystache.render, template, context) |