From 640a6e1dce8d91e9cb1f817fadbb37a2c9d294bf Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 27 Dec 2020 21:15:17 +0100 Subject: [PATCH] Refs #32290 -- Added {% extends %} test for relative path in variable. --- tests/template_tests/relative_templates/one_var.html | 3 +++ tests/template_tests/test_extends_relative.py | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 tests/template_tests/relative_templates/one_var.html 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')