diff options
author | David Lord <davidism@gmail.com> | 2022-03-07 09:14:21 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-03-07 09:14:21 -0800 |
commit | a150ff749a0347c41e8e353c2ce2063e8f84ab42 (patch) | |
tree | abce210072c8825316c155ee9990cc0046c5f4fa /tests | |
parent | a819eb37bd182a4e668ab2299f303630df0d7973 (diff) | |
download | jinja2-a150ff749a0347c41e8e353c2ce2063e8f84ab42.tar.gz |
add parens around auto_await for filters and calls
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_async.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_async.py b/tests/test_async.py index 635727e..c9ba70c 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -642,3 +642,19 @@ def test_native_list_async(async_native_env): assert rv == [0, 1, 2] asyncio.run(_test()) + + +def test_getitem_after_filter(): + env = Environment(enable_async=True) + env.filters["add_each"] = lambda v, x: [i + x for i in v] + t = env.from_string("{{ (a|add_each(2))[1:] }}") + out = t.render(a=range(3)) + assert out == "[3, 4]" + + +def test_getitem_after_call(): + env = Environment(enable_async=True) + env.globals["add_each"] = lambda v, x: [i + x for i in v] + t = env.from_string("{{ add_each(a, 2)[1:] }}") + out = t.render(a=range(3)) + assert out == "[3, 4]" |