From: Armin Ronacher Date: Wed, 28 Dec 2016 12:33:37 +0000 (+0100) Subject: Improved async test X-Git-Tag: 2.9~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62989728cdff33d121dd65915b639444932a662a;p=thirdparty%2Fjinja.git Improved async test --- diff --git a/tests/test_async.py b/tests/test_async.py index 02160403..00dfffe1 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -44,11 +44,14 @@ def test_await_on_calls(): @pytest.mark.skipif(not have_async_gen, reason='No async generators') def test_await_and_macros(): - t = Template('{% macro foo(x) %}[{{ x }}]{% endmacro %}{{ foo(42) }}', - enable_async=True) + t = Template('{% macro foo(x) %}[{{ x }}][{{ async_func() }}]' + '{% endmacro %}{{ foo(42) }}', enable_async=True) + + async def async_func(): + return 42 async def func(): - return await t.render_async() + return await t.render_async(async_func=async_func) rv = run(func) - assert rv == '[42]' + assert rv == '[42][42]'