|
@@ -1,4 +1,4 @@
|
|
|
-from django.template import TemplateDoesNotExist, TemplateSyntaxError
|
|
|
+from django.template import Template, TemplateDoesNotExist, TemplateSyntaxError
|
|
|
from django.test import SimpleTestCase
|
|
|
|
|
|
from ..utils import setup
|
|
@@ -64,3 +64,14 @@ class ExceptionsTests(SimpleTestCase):
|
|
|
"""
|
|
|
with self.assertRaises(TemplateSyntaxError):
|
|
|
self.engine.render_to_string("exception05")
|
|
|
+
|
|
|
+ def test_unknown_origin_relative_path(self):
|
|
|
+ files = ["./nonexistent.html", "../nonexistent.html"]
|
|
|
+ for template_name in files:
|
|
|
+ with self.subTest(template_name=template_name):
|
|
|
+ msg = (
|
|
|
+ f"The relative path '{template_name}' cannot be evaluated due to "
|
|
|
+ "an unknown template origin."
|
|
|
+ )
|
|
|
+ with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
|
|
+ Template(f"{{% extends '{template_name}' %}}")
|