diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-12-27 21:15:17 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-01-27 09:37:03 +0100 |
commit | 640a6e1dce8d91e9cb1f817fadbb37a2c9d294bf (patch) | |
tree | c91ac244264f37a261e43269cb71ca27be656db5 /tests/template_tests | |
parent | f4272d000af598018247fe9687dac0fd02a29a7c (diff) | |
download | django-640a6e1dce8d91e9cb1f817fadbb37a2c9d294bf.tar.gz |
Refs #32290 -- Added {% extends %} test for relative path in variable.
Diffstat (limited to 'tests/template_tests')
-rw-r--r-- | tests/template_tests/relative_templates/one_var.html | 3 | ||||
-rw-r--r-- | tests/template_tests/test_extends_relative.py | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/template_tests/relative_templates/one_var.html b/tests/template_tests/relative_templates/one_var.html new file mode 100644 index 0000000000..1d040e1fe8 --- /dev/null +++ b/tests/template_tests/relative_templates/one_var.html @@ -0,0 +1,3 @@ +{% extends tmpl %} + +{% block content %}{{ block.super }} one{% endblock %} diff --git a/tests/template_tests/test_extends_relative.py b/tests/template_tests/test_extends_relative.py index 12324f0df6..9e8d7fc9b9 100644 --- a/tests/template_tests/test_extends_relative.py +++ b/tests/template_tests/test_extends_relative.py @@ -16,6 +16,12 @@ class ExtendsRelativeBehaviorTests(SimpleTestCase): output = template.render(Context({})) self.assertEqual(output.strip(), 'three two one') + def test_normal_extend_variable(self): + engine = Engine(dirs=[RELATIVE]) + template = engine.get_template('one_var.html') + output = template.render(Context({'tmpl': './two.html'})) + self.assertEqual(output.strip(), 'three two one') + def test_dir1_extend(self): engine = Engine(dirs=[RELATIVE]) template = engine.get_template('dir1/one.html') |