Skip to content

Commit

Permalink
run test_loop_errors under trio
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Apr 8, 2024
1 parent 6439218 commit 8ed364c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,17 +467,19 @@ def test_reversed_bug(self, test_env_async):
)
assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3"

def test_loop_errors(self, test_env_async):
def test_loop_errors(self, test_env_async, run_async_fn):
tmpl = test_env_async.from_string(
"""{% for item in [1] if loop.index
== 0 %}...{% endfor %}"""
)
pytest.raises(UndefinedError, tmpl.render)
with pytest.raises(UndefinedError):
run_async_fn(tmpl.render_async)

tmpl = test_env_async.from_string(
"""{% for item in [] %}...{% else
%}{{ loop }}{% endfor %}"""
)
assert tmpl.render() == ""
assert run_async_fn(tmpl.render_async) == ""

def test_loop_filter(self, test_env_async):
tmpl = test_env_async.from_string(
Expand Down

0 comments on commit 8ed364c

Please sign in to comment.