Ticket #32290: ticket_32290_tests.diff

File ticket_32290_tests.diff, 2.2 KB (added by Mariusz Felisiak, 4 years ago)
  • new file tests/template_tests/relative_templates/dir1/dir2/inc3.html

    commit 77c7864933c1c623c69e4f74837813a9aff14341
    Author: Mariusz Felisiak <felisiak.mariusz@gmail.com>
    Date:   Mon Dec 21 20:01:58 2020 +0100
    
        tests
    
    diff --git a/tests/template_tests/relative_templates/dir1/dir2/inc3.html b/tests/template_tests/relative_templates/dir1/dir2/inc3.html
    new file mode 100644
    index 0000000000..7a8374df51
    - +  
     1{% include tmpl %}
  • new file tests/template_tests/relative_templates/one2.html

    diff --git a/tests/template_tests/relative_templates/one2.html b/tests/template_tests/relative_templates/one2.html
    new file mode 100644
    index 0000000000..1d040e1fe8
    - +  
     1{% extends tmpl %}
     2
     3{% block content %}{{ block.super }} one{% endblock %}
  • tests/template_tests/test_extends_relative.py

    diff --git a/tests/template_tests/test_extends_relative.py b/tests/template_tests/test_extends_relative.py
    index 12324f0df6..53f769a31c 100644
    a b class ExtendsRelativeBehaviorTests(SimpleTestCase):  
    1616        output = template.render(Context({}))
    1717        self.assertEqual(output.strip(), 'three two one')
    1818
     19    def test_normal_var_extend(self):
     20        engine = Engine(dirs=[RELATIVE])
     21        template = engine.get_template('one2.html')
     22        output = template.render(Context({'tmpl': './two.html'}))
     23        self.assertEqual(output.strip(), 'three two one')
     24
    1925    def test_dir1_extend(self):
    2026        engine = Engine(dirs=[RELATIVE])
    2127        template = engine.get_template('dir1/one.html')
    class IncludeRelativeBehaviorTests(SimpleTestCase):  
    6470        output = template.render(Context({}))
    6571        self.assertEqual(output.strip(), 'dir2 include')
    6672
     73    def test_normal_var_include(self):
     74        engine = Engine(dirs=[RELATIVE])
     75        template = engine.get_template('dir1/dir2/inc3.html')
     76        output = template.render(Context({'tmpl': './include_content.html'}))
     77        self.assertEqual(output.strip(), 'dir2 include')
     78
    6779    def test_dir2_include(self):
    6880        engine = Engine(dirs=[RELATIVE])
    6981        template = engine.get_template('dir1/dir2/inc1.html')
Back to Top