Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updated to include a test which fails currently due to issue #79 #123

Closed
wants to merge 1 commit into from

2 participants

@orokusaki

Hey Armin,

Updated to include a test which fails currently due to issue #79 #79 ), but would not fail after pull request #83 ( #83 ).

Thanks
Michael

@mitsuhiko mitsuhiko closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 10, 2012
  1. Updated to include a test which fails currently due to issue #79 ( mi…

    Michael A authored
    …tsuhiko/jinja2#79 ), but would not fail after pull request #83 ( mitsuhiko/jinja2#83 ).
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 2 deletions.
  1. +24 −2 jinja2/testsuite/inheritance.py
View
26 jinja2/testsuite/inheritance.py
@@ -12,7 +12,7 @@
from jinja2.testsuite import JinjaTestCase
-from jinja2 import Environment, DictLoader
+from jinja2 import Environment, DictLoader, TemplateError
LAYOUTTEMPLATE = '''\
@@ -53,13 +53,26 @@
{% endblock %}
'''
+DOUBLEEXTENDS = '''\
+{% extends "layout" %}
+{% extends "layout" %}
+{% block block1 %}
+ {% if false %}
+ {% block block2 %}
+ this should workd
+ {% endblock %}
+ {% endif %}
+{% endblock %}
+'''
+
env = Environment(loader=DictLoader({
'layout': LAYOUTTEMPLATE,
'level1': LEVEL1TEMPLATE,
'level2': LEVEL2TEMPLATE,
'level3': LEVEL3TEMPLATE,
'level4': LEVEL4TEMPLATE,
- 'working': WORKINGTEMPLATE
+ 'working': WORKINGTEMPLATE,
+ 'doublee': DOUBLEEXTENDS
}), trim_blocks=True)
@@ -105,6 +118,15 @@ def test_super(self):
def test_working(self):
tmpl = env.get_template('working')
+
+ def test_double_extends(self):
+ """
+ Ensures that a template with more than 1 {% extends ... %} usage raises a ``TemplateError``.
+ """
+ try:
+ tmpl = env.get_template('doublee')
+ except Exception, e:
+ assert isinstance(e, TemplateError)
def test_reuse_blocks(self):
tmpl = env.from_string('{{ self.foo() }}|{% block foo %}42'
Something went wrong with that request. Please try again.