From eeadb3a763fe2da39fbdc4c645ac786257b3bd73 Mon Sep 17 00:00:00 2001 From: Takahiro Fujiwara Date: Mon, 18 Feb 2013 23:56:22 +0900 Subject: Added a test case for templating with escaped double braces. --- pyramid/tests/test_scaffolds/test_template.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pyramid/tests/test_scaffolds/test_template.py b/pyramid/tests/test_scaffolds/test_template.py index d7cf638b6..da6caffb9 100644 --- a/pyramid/tests/test_scaffolds/test_template.py +++ b/pyramid/tests/test_scaffolds/test_template.py @@ -11,7 +11,7 @@ class TestTemplate(unittest.TestCase): inst = self._makeOne() result = inst.render_template('{{a}} {{b}}', {'a':'1', 'b':'2'}) self.assertEqual(result, bytes_('1 2')) - + def test_render_template_expr_failure(self): inst = self._makeOne() self.assertRaises(AttributeError, inst.render_template, @@ -37,6 +37,11 @@ class TestTemplate(unittest.TestCase): result = inst.render_template('{{a}}', {'a':None}) self.assertEqual(result, b'') + def test_render_template_with_escaped_double_quotes(self): + inst = self._makeOne() + result = inst.render_template('{{a}} {{b}} \{\{a\}\} \{\{c\}\}', {'a':'1', 'b':'2'}) + self.assertEqual(result, bytes_('1 2 {{a}} {{c}}')) + def test_module_dir(self): import sys import pkg_resources @@ -90,7 +95,7 @@ class TestTemplate(unittest.TestCase): 'overwrite':False, 'interactive':False, }) - + def test_write_files_path_missing(self): L = [] inst = self._makeOne() @@ -132,9 +137,9 @@ class DummyOptions(object): simulate = False overwrite = False interactive = False - + class DummyCommand(object): options = DummyOptions() verbosity = 1 - - + + -- cgit v1.2.3