summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAmy <leiamy12@gmail.com>2021-05-21 13:56:58 -0400
committerDavid Lord <davidism@gmail.com>2021-05-21 11:24:04 -0700
commitf3bc9c6a915badd3871eb1bc5aae5421d2f6496d (patch)
tree1783b23441621d6f130d46d2680c00c65c5ceeec /tests
parent1037184acd368f2d99241a8677a80854e19d2e1b (diff)
downloadjinja2-f3bc9c6a915badd3871eb1bc5aae5421d2f6496d.tar.gz
clear assignments in loops at end of iteration
Diffstat (limited to 'tests')
-rw-r--r--tests/test_regression.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_regression.py b/tests/test_regression.py
index 4491dab..7e23369 100644
--- a/tests/test_regression.py
+++ b/tests/test_regression.py
@@ -746,6 +746,13 @@ End"""
tmpl = env.get_template("base")
assert tmpl.render() == "42 y"
+ def test_nested_loop_scoping(self, env):
+ tmpl = env.from_string(
+ "{% set output %}{% for x in [1,2,3] %}hello{% endfor %}"
+ "{% endset %}{{ output }}"
+ )
+ assert tmpl.render() == "hellohellohello"
+
@pytest.mark.parametrize("unicode_char", ["\N{FORM FEED}", "\x85"])
def test_unicode_whitespace(env, unicode_char):