diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index 28d85cae9d..e1e448acba 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -441,6 +441,18 @@ class Templates(TestCase): output1 = template.render(Context({'foo': range(3), 'get_value': lambda: next(gen1)})) self.assertEqual(output1, '[0,1,2,3]', 'Expected [0,1,2,3] in first template, got {0}'.format(output1)) + def test_ifchanged_render_once(self): + """ Test for ticket #19890. The content of ifchanged template tag was + rendered twice.""" + + template = Template('{% ifchanged %}{{ gen.next }}{% endifchanged %}') + def gen(): + for i in xrange(1,10): + yield 'iteration no %d' % i + + output = template.render(Context({'gen': gen()})) + self.assertEqual(output, 'iteration no 1') + def test_templates(self): template_tests = self.get_template_tests() filter_tests = filters.get_filter_tests() |
