From: Kevin Brown Date: Sat, 16 May 2020 21:17:51 +0000 (-0400) Subject: Switch to parameterizing api tests X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7151d778c45cfcd230dc949045e8bf7e3d21ec74;p=thirdparty%2Fjinja.git Switch to parameterizing api tests --- diff --git a/tests/test_api.py b/tests/test_api.py index 2679e8fb..759d5cc1 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -194,22 +194,19 @@ class TestMeta: i = meta.find_referenced_templates(ast) assert list(i) == ["layout.html", "test.html", "meh.html", "muh.html"] - def test_find_included_templates(self, env): - ast = env.parse('{% include ["foo.html", "bar.html"] %}') - i = meta.find_referenced_templates(ast) - assert list(i) == ["foo.html", "bar.html"] - - ast = env.parse('{% include ("foo.html", "bar.html") %}') - i = meta.find_referenced_templates(ast) - assert list(i) == ["foo.html", "bar.html"] - - ast = env.parse('{% include ["foo.html", "bar.html", foo] %}') - i = meta.find_referenced_templates(ast) - assert list(i) == ["foo.html", "bar.html", None] - - ast = env.parse('{% include ("foo.html", "bar.html", foo) %}') + @pytest.mark.parametrize( + "include,templates", + ( + ('{% include ["foo.html", "bar.html"] %}', ["foo.html", "bar.html"]), + ('{% include ("foo.html", "bar.html") %}', ["foo.html", "bar.html"]), + ('{% include ["foo.html", "bar.html", foo] %}', ["foo.html", "bar.html", None]), + ('{% include ("foo.html", "bar.html", foo) %}', ["foo.html", "bar.html", None]) + ) + ) + def test_find_included_templates(self, env, include, templates): + ast = env.parse(include) i = meta.find_referenced_templates(ast) - assert list(i) == ["foo.html", "bar.html", None] + assert list(i) == templates class TestStreaming: