Commit 331f149e by Chris Jerdonek

Moved four tests from test_template to test_renderengine.

parent b05d6f85
...@@ -135,3 +135,35 @@ class RenderEngineTestCase(unittest.TestCase): ...@@ -135,3 +135,35 @@ class RenderEngineTestCase(unittest.TestCase):
self._assert_render("Al: Hi; Bo: Hi; ", template, context) self._assert_render("Al: Hi; Bo: Hi; ", template, context)
def test_render__tag_in_value(self):
"""
Context values should not be treated as templates (issue #44).
"""
template = '{{test}}'
context = {'test': '{{hello}}'}
self._assert_render('{{hello}}', template, context)
def test_render__section_in_value(self):
"""
Context values should not be treated as templates (issue #44).
"""
template = '{{test}}'
context = {'test': '{{#hello}}'}
self._assert_render('{{#hello}}', template, context)
def test_render__section__lambda(self):
template = '{{#test}}Mom{{/test}}'
context = {'test': (lambda text: 'Hi %s' % text)}
self._assert_render('Hi Mom', template, context)
def test_render__section__lambda__tag_in_output(self):
"""
Check that callable output isn't treated as a template string (issue #46).
"""
template = '{{#test}}Mom{{/test}}'
context = {'test': (lambda text: '{{hi}} %s' % text)}
self._assert_render('{{hi}} Mom', template, context)
...@@ -220,42 +220,6 @@ class TemplateTestCase(unittest.TestCase): ...@@ -220,42 +220,6 @@ class TemplateTestCase(unittest.TestCase):
self.assertTrue(isinstance(actual, str)) self.assertTrue(isinstance(actual, str))
self.assertEquals(actual, 'Poincaré') self.assertEquals(actual, 'Poincaré')
def test_render__tag_in_value(self):
"""
Context values should not be treated as templates (issue #44).
"""
template = Template('{{test}}')
context = {'test': '{{hello}}'}
actual = template.render(context)
self.assertEquals(actual, '{{hello}}')
def test_render__section_in_value(self):
"""
Context values should not be treated as templates (issue #44).
"""
template = Template('{{test}}')
context = {'test': '{{#hello}}'}
actual = template.render(context)
self.assertEquals(actual, '{{#hello}}')
def test_render__section__lambda(self):
template = Template('{{#test}}Mom{{/test}}')
context = {'test': (lambda text: 'Hi %s' % text)}
actual = template.render(context)
self.assertEquals(actual, 'Hi Mom')
def test_render__section__lambda__tag_in_output(self):
"""
Check that callable output isn't treated as a template string (issue #46).
"""
template = Template('{{#test}}Mom{{/test}}')
context = {'test': (lambda text: '{{hi}} %s' % text)}
actual = template.render(context)
self.assertEquals(actual, '{{hi}} Mom')
def test_render__nonascii_template(self): def test_render__nonascii_template(self):
""" """
Test passing a non-unicode template with non-ascii characters. Test passing a non-unicode template with non-ascii characters.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment