summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-08-15 15:39:22 -0400
committerTim Graham <timograham@gmail.com>2016-08-15 15:40:34 -0400
commit020ba4bf91aec9b13f415ace5cd538958ce3b608 (patch)
treed60fd177fc754784915941184060a8d70d3c0a02 /tests
parent54771f6605147136ca954e2e3fc35ad804a89327 (diff)
[1.10.x] Fixed #27058 -- Reallowed the {% for %} tag to unpack any iterable.
Thanks Sergei Maertens for the report and patch. Backport of 937d752d3deabebe60dfbe9ff9823772730f336a from master
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/syntax_tests/test_for.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_for.py b/tests/template_tests/syntax_tests/test_for.py
index 03c2e6ee9b..4af7881e57 100644
--- a/tests/template_tests/syntax_tests/test_for.py
+++ b/tests/template_tests/syntax_tests/test_for.py
@@ -126,6 +126,11 @@ class ForTagTests(SimpleTestCase):
output = self.engine.render_to_string('for-tag-filter-ws', {'s': 'abc'})
self.assertEqual(output, 'abc')
+ @setup({'for-tag-unpack-strs': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
+ def test_for_tag_unpack_strs(self):
+ output = self.engine.render_to_string('for-tag-unpack-strs', {'items': ('ab', 'ac')})
+ self.assertEqual(output, 'a:b/a:c/')
+
@setup({'for-tag-unpack10': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
def test_for_tag_unpack10(self):
with self.assertRaisesMessage(ValueError, 'Need 2 values to unpack in for loop; got 3.'):