From 24db451787fb3b966bca0eaf3ad4205fa8aaabf6 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 19 May 2008 09:28:17 +0200 Subject: [PATCH] added unittest for the latest fixed bug --HG-- branch : trunk --- tests/test_forloop.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_forloop.py b/tests/test_forloop.py index 4cdb3bb..7469f93 100644 --- a/tests/test_forloop.py +++ b/tests/test_forloop.py @@ -24,6 +24,12 @@ NONITER = '''{% for item in none %}...{% endfor %}''' RECURSIVE = '''{% for item in seq recursive -%} [{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}] {%- endfor %}''' +LOOPLOOP = '''{% for row in table %} + {%- set rowloop = loop -%} + {% for cell in row -%} + [{{ rowloop.index }}|{{ loop.index }}] + {%- endfor %} +{%- endfor %}''' def test_simple(env): @@ -91,3 +97,8 @@ def test_recursive(env): dict(a=2, b=[dict(a=1), dict(a=2)]), dict(a=3, b=[dict(a='a')]) ]) == '[1<[1][2]>][2<[1][2]>][3<[a]>]' + + +def test_looploop(env): + tmpl = env.from_string(LOOPLOOP) + assert tmpl.render(table=['ab', 'cd']) == '[1|1][1|2][2|1][2|2]' -- 2.26.2