summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_if_changed.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template_tests/syntax_tests/test_if_changed.py')
-rw-r--r--tests/template_tests/syntax_tests/test_if_changed.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_if_changed.py b/tests/template_tests/syntax_tests/test_if_changed.py
index 09cdc34a88..ee67c64218 100644
--- a/tests/template_tests/syntax_tests/test_if_changed.py
+++ b/tests/template_tests/syntax_tests/test_if_changed.py
@@ -196,3 +196,17 @@ class IfChangedTests(SimpleTestCase):
template = self.engine.from_string('{% ifchanged %}{% cycle "1st time" "2nd time" %}{% endifchanged %}')
output = template.render(Context({}))
self.assertEqual(output, '1st time')
+
+ def test_include(self):
+ """
+ #23516 -- This works as a regression test only if the cached loader
+ isn't used. Hence we don't use the @setup decorator.
+ """
+ engine = Engine(loaders=[
+ ('django.template.loaders.locmem.Loader', {
+ 'template': '{% for x in vars %}{% include "include" %}{% endfor %}',
+ 'include': '{% ifchanged %}{{ x }}{% endifchanged %}',
+ }),
+ ])
+ output = engine.render_to_string('template', dict(vars=[1, 1, 2, 2, 3, 3]))
+ self.assertEqual(output, "123")