diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-01-25 09:51:43 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-01-26 20:49:07 +0300 |
commit | 92337b2b7ff92e1f9fec1c01048366042b848998 (patch) | |
tree | 529a8d180a840df671c5ff57c27513913e41d83a /contrib/python/Jinja2/py3/tests/test_inheritance.py | |
parent | ccdd7d3aed84ad876ff5d2045b1f1cc5eedb9aea (diff) | |
download | ydb-92337b2b7ff92e1f9fec1c01048366042b848998.tar.gz |
Update contrib/python/Jinja2/py3 to 3.1.3
Diffstat (limited to 'contrib/python/Jinja2/py3/tests/test_inheritance.py')
-rw-r--r-- | contrib/python/Jinja2/py3/tests/test_inheritance.py | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/contrib/python/Jinja2/py3/tests/test_inheritance.py b/contrib/python/Jinja2/py3/tests/test_inheritance.py index 0c20d4da7d3..0a525e7ac97 100644 --- a/contrib/python/Jinja2/py3/tests/test_inheritance.py +++ b/contrib/python/Jinja2/py3/tests/test_inheritance.py @@ -287,26 +287,34 @@ class TestInheritance: env = Environment( loader=DictLoader( { - "default": "{% block x required %}data {# #}{% endblock %}", - "default1": "{% block x required %}{% block y %}" - "{% endblock %} {% endblock %}", - "default2": "{% block x required %}{% if true %}" - "{% endif %} {% endblock %}", - "level1": "{% if default %}{% extends default %}" - "{% else %}{% extends 'default' %}{% endif %}" - "{%- block x %}CHILD{% endblock %}", + "empty": "{% block x required %}{% endblock %}", + "blank": "{% block x required %} {# c #}{% endblock %}", + "text": "{% block x required %}data {# c #}{% endblock %}", + "block": "{% block x required %}{% block y %}" + "{% endblock %}{% endblock %}", + "if": "{% block x required %}{% if true %}" + "{% endif %}{% endblock %}", + "top": "{% extends t %}{% block x %}CHILD{% endblock %}", } ) ) - t = env.get_template("level1") + t = env.get_template("top") + assert t.render(t="empty") == "CHILD" + assert t.render(t="blank") == "CHILD" - with pytest.raises( + required_block_check = pytest.raises( TemplateSyntaxError, match="Required blocks can only contain comments or whitespace", - ): - assert t.render(default="default") - assert t.render(default="default2") - assert t.render(default="default3") + ) + + with required_block_check: + t.render(t="text") + + with required_block_check: + t.render(t="block") + + with required_block_check: + t.render(t="if") def test_required_with_scope(self, env): env = Environment( @@ -347,8 +355,11 @@ class TestInheritance: ) ) tmpl = env.get_template("child") + with pytest.raises(TemplateSyntaxError): tmpl.render(default="default1", seq=list(range(3))) + + with pytest.raises(TemplateSyntaxError): tmpl.render(default="default2", seq=list(range(3))) |