summaryrefslogtreecommitdiff
path: root/tests/template_tests/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-02-14 10:21:06 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2015-02-14 10:21:06 +0100
commit47ee7b48adbcc0dafc3404034286c5fcbcd1cea6 (patch)
tree88963887c1a5aaa265afa9e4733763d51f10fa36 /tests/template_tests/tests.py
parent18c0aaa9123579375294fcc4a8ee7e3530176b88 (diff)
Fixed #24338 -- Accepted Template wrapper in {% extends %}.
Explicitly checking for django.template.Template subclasses is preferrable to duck-typing because both the django.template.Template and django.template.backends.django.Template have a render() method. Thanks spectras for the report.
Diffstat (limited to 'tests/template_tests/tests.py')
-rw-r--r--tests/template_tests/tests.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index c57c3d1479..ffc3064b41 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -10,7 +10,7 @@ from django.contrib.auth.models import Group
from django.core import urlresolvers
from django.template import (
Context, RequestContext, Template, TemplateSyntaxError,
- base as template_base, loader,
+ base as template_base, engines, loader,
)
from django.template.engine import Engine
from django.template.loaders import app_directories, filesystem
@@ -414,6 +414,16 @@ class TemplateRegressionTests(SimpleTestCase):
t1 = Template('{% debug %}')
self.assertIn("清風", t1.render(c1))
+ def test_extends_generic_template(self):
+ """
+ {% extends %} accepts django.template.backends.django.Template (#24338).
+ """
+ parent = engines['django'].from_string(
+ '{% block content %}parent{% endblock %}')
+ child = engines['django'].from_string(
+ '{% extends parent %}{% block content %}child{% endblock %}')
+ self.assertEqual(child.render({'parent': parent}), 'child')
+
class TemplateTagLoading(SimpleTestCase):