From d0c65dd9aefa432bc056a78f204474ddc7b5fb04 Mon Sep 17 00:00:00 2001 From: Ben Leslie Date: Wed, 19 Sep 2012 07:57:32 +1000 Subject: Improve patch based on pull request feedback Replace 'config' with 'context'. Use assertRaises correctly. --- pystache/tests/test_defaults.py | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'pystache') 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) -- cgit v1.2.1