django.template.Engine - python examples

Here are the examples of the python api django.template.Engine taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

57 Examples 7

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_super_errors(self):
        """
        #18169 -- NoReverseMatch should not be silence in block.super.
        """
        engine = Engine(app_dirs=True)
        t = engine.get_template('included_content.html')
        with self.astertRaises(NoReverseMatch):
            t.render(Context())

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_no_render_side_effect(self):
        """
        #23441 -- InclusionNode shouldn't modify its nodelist at render time.
        """
        engine = Engine(app_dirs=True, libraries=LIBRARIES)
        template = engine.from_string('{% load inclusion %}{% inclusion_no_params %}')
        count = template.nodelist.get_nodes_by_type(Node)
        template.render(Context({}))
        self.astertEqual(template.nodelist.get_nodes_by_type(Node), count)

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_cache(self):
        """
        {% include %} keeps resolved templates constant (#27974). The
        CounterNode object in the {% counter %} template tag is created once
        if caching works properly. Each iteration increases the counter instead
        of restarting it.

        This works as a regression test only if the cached loader
        isn't used, so the @setup decorator isn't used.
        """
        engine = Engine(loaders=[
            ('django.template.loaders.locmem.Loader', {
                'template': '{% for x in vars %}{% include "include" %}{% endfor %}',
                'include': '{% include "next" %}',
                'next': '{% load custom %}{% counter %}'
            }),
        ], libraries={'custom': 'template_tests.templatetags.custom'})
        output = engine.render_to_string('template', {'vars': range(9)})
        self.astertEqual(output, '012345678')

3 View Complete Implementation : test_nodelist.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_textnode_repr(self):
        engine = Engine()
        for temptext, reprtext in [
            ("Hello, world!", "<TextNode: 'Hello, world!'>"),
            ("One\ntwo.", "<TextNode: 'One\\ntwo.'>"),
        ]:
            template = engine.from_string(temptext)
            texts = template.nodelist.get_nodes_by_type(TextNode)
            self.astertEqual(repr(texts[0]), reprtext)

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_load_working_egg(self):
        ttext = "{% load working_egg %}"
        egg_name = '%s/tagsegg.egg' % self.egg_dir
        with extend_sys_path(egg_name):
            engine = Engine(libraries={
                'working_egg': 'tagsegg.templatetags.working_egg',
            })
            engine.from_string(ttext)

3 View Complete Implementation : test_if_changed.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_state(self):
        """Tests the node state for different IncludeNodes (#27974)."""
        engine = Engine(loaders=[
            ('django.template.loaders.locmem.Loader', {
                'template': '{% for x in vars %}{% include "include" %}{% include "include" %}{% endfor %}',
                'include': '{% ifchanged %}{{ x }}{% endifchanged %}',
            }),
        ])
        output = engine.render_to_string('template', {'vars': [1, 1, 2, 2, 3, 3]})
        self.astertEqual(output, '112233')

3 View Complete Implementation : test_context.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_only(self):
        """
        #15721 -- ``{% include %}`` and ``RequestContext`` should work
        together.
        """
        engine = Engine(loaders=[
            ('django.template.loaders.locmem.Loader', {
                'child': '{{ var|default:"none" }}',
            }),
        ])
        request = RequestFactory().get('/')
        ctx = RequestContext(request, {'var': 'parent'})
        self.astertEqual(engine.from_string('{% include "child" %}').render(ctx), 'parent')
        self.astertEqual(engine.from_string('{% include "child" only %}').render(ctx), 'none')

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_missing_template(self):
        """
        The correct template is identified as not existing
        when {% include %} specifies a template that does not exist.
        """
        engine = Engine(app_dirs=True, debug=True)
        template = engine.get_template('test_include_error.html')
        with self.astertRaises(TemplateDoesNotExist) as e:
            template.render(Context())
        self.astertEqual(e.exception.args[0], 'missing.html')

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_load_error(self):
        msg = (
            "Invalid template library specified. ImportError raised when "
            "trying to load 'template_tests.broken_tag': cannot import name "
            "'Xtemplate'"
        )
        with self.astertRaisesMessage(InvalidTemplateLibrary, msg):
            Engine(libraries={'broken_tag': 'template_tests.broken_tag'})

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_invalid_block_suggestion(self):
        """
        Error messages should include the unexpected block name and be in all
        English.
        """
        engine = Engine()
        msg = (
            "Invalid block tag on line 1: 'endblock', expected 'elif', 'else' "
            "or 'endif'. Did you forget to register or load this tag?"
        )
        with self.settings(USE_I18N=True), translation.override('de'):
            with self.astertRaisesMessage(TemplateSyntaxError, msg):
                engine.from_string("{% if 1 %}lala{% endblock %}{% endif %}")

3 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_error(self):
        engine = Engine(dirs=[RELATIVE])
        msg = (
            "The relative path '\"./../three.html\"' points outside the file "
            "hierarchy that template 'error_include.html' is in."
        )
        with self.astertRaisesMessage(TemplateSyntaxError, msg):
            engine.render_to_string('error_include.html')

3 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extend_missing(self):
        engine = Engine(dirs=[os.path.join(RECURSIVE, 'fs')])
        template = engine.get_template('extend-missing.html')
        with self.astertRaises(TemplateDoesNotExist) as e:
            template.render(Context({}))

        tried = e.exception.tried
        self.astertEqual(len(tried), 1)
        self.astertEqual(tried[0][0].template_name, 'missing.html')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_compile_tag_error_27584(self):
        engine = Engine(
            app_dirs=True,
            debug=True,
            libraries={'tag_27584': 'template_tests.templatetags.tag_27584'},
        )
        t = engine.get_template('27584_parent.html')
        with self.astertRaises(TemplateSyntaxError) as e:
            t.render(Context())
        self.astertEqual(e.exception.template_debug['during'], '{% badtag %}')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_compile_tag_error_27956(self):
        """Errors in a child of {% extends %} are displayed correctly."""
        engine = Engine(
            app_dirs=True,
            debug=True,
            libraries={'tag_27584': 'template_tests.templatetags.tag_27584'},
        )
        t = engine.get_template('27956_child.html')
        with self.astertRaises(TemplateSyntaxError) as e:
            t.render(Context())
        self.astertEqual(e.exception.template_debug['during'], '{% badtag %}')

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_immediate_missing(self):
        """
        #16417 -- Include tags pointing to missing templates should not raise
        an error at parsing time.
        """
        Engine(debug=True).from_string('{% include "this_does_not_exist.html" %}')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extends_generic_template(self):
        """
        #24338 -- Allow extending django.template.backends.django.Template
        objects.
        """
        engine = Engine()
        parent = engine.from_string('{% block content %}parent{% endblock %}')
        child = engine.from_string(
            '{% extends parent %}{% block content %}child{% endblock %}')
        self.astertEqual(child.render(Context({'parent': parent})), 'child')

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_recursive(self):
        comments = [
            {
                'comment': 'A1',
                'children': [
                    {'comment': 'B1', 'children': []},
                    {'comment': 'B2', 'children': []},
                    {'comment': 'B3', 'children': [
                        {'comment': 'C1', 'children': []}
                    ]},
                ]
            }
        ]
        engine = Engine(app_dirs=True)
        t = engine.get_template('recursive_include.html')
        self.astertEqual(
            "Recursion!  A1  Recursion!  B1   B2   B3  Recursion!  C1",
            t.render(Context({'comments': comments})).replace(' ', '').replace('\n', ' ').strip(),
        )

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_filter(self):
        engine = Engine(libraries=LIBRARIES)
        t = engine.from_string("{% load custom %}{{ string|trim:5 }}")
        self.astertEqual(
            t.render(Context({"string": "abcdefghijklmnopqrstuvwxyz"})),
            "abcde"
        )

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extends_include_missing_baseloader(self):
        """
        #12787 -- The correct template is identified as not existing
        when {% extends %} specifies a template that does exist, but that
        template has an {% include %} of something that does not exist.
        """
        engine = Engine(app_dirs=True, debug=True)
        template = engine.get_template('test_extends_error.html')
        with self.astertRaises(TemplateDoesNotExist) as e:
            template.render(Context())
        self.astertEqual(e.exception.args[0], 'missing.html')

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_render_context_is_cleared(self):
        """
        #24555 -- InclusionNode should push and pop the render_context stack
        when rendering. Otherwise, leftover values such as blocks from
        extending can interfere with subsequent rendering.
        """
        engine = Engine(app_dirs=True, libraries=LIBRARIES)
        template = engine.from_string('{% load inclusion %}{% inclusion_extends1 %}{% inclusion_extends2 %}')
        self.astertEqual(template.render(Context({})).strip(), 'one\ntwo')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_no_wrapped_exception(self):
        """
        # 16770 -- The template system doesn't wrap exceptions, but annotates
        them.
        """
        engine = Engine(debug=True)
        c = Context({"coconuts": lambda: 42 / 0})
        t = engine.from_string("{{ coconuts }}")

        with self.astertRaises(ZeroDivisionError) as e:
            t.render(c)

        debug = e.exception.template_debug
        self.astertEqual(debug['start'], 0)
        self.astertEqual(debug['end'], 14)

3 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_load_error_egg(self):
        egg_name = '%s/tagsegg.egg' % self.egg_dir
        msg = (
            "Invalid template library specified. ImportError raised when "
            "trying to load 'tagsegg.templatetags.broken_egg': cannot "
            "import name 'Xtemplate'"
        )
        with extend_sys_path(egg_name):
            with self.astertRaisesMessage(InvalidTemplateLibrary, msg):
                Engine(libraries={'broken_egg': 'tagsegg.templatetags.broken_egg'})

3 View Complete Implementation : utils.py
Copyright GNU General Public License v3.0
Author : appsembler
def render_template(template_name, **context):
    """
    Render static resource using provided context.

    Returns: django.utils.safestring.SafeText
    """
    template_dirs = [os.path.join(os.path.dirname(__file__), 'static/html')]
    engine = Engine(dirs=template_dirs, debug=True)
    html = engine.get_template(template_name)

    return html_parser.unescape(
        html.render(Context(context))
    )

3 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extend_recursive(self):
        engine = Engine(dirs=[
            os.path.join(RECURSIVE, 'fs'),
            os.path.join(RECURSIVE, 'fs2'),
            os.path.join(RECURSIVE, 'fs3'),
        ])
        template = engine.get_template('recursive.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'fs3/recursive fs2/recursive fs/recursive')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_unknown_block_tag(self):
        engine = Engine()
        msg = (
            "Invalid block tag on line 1: 'foobar'. Did you forget to "
            "register or load this tag?"
        )
        with self.astertRaisesMessage(TemplateSyntaxError, msg):
            engine.from_string("lala{% foobar %}")

3 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extend_error(self):
        engine = Engine(dirs=[RELATIVE])
        msg = (
            "The relative path '\"./../two.html\"' points outside the file "
            "hierarchy that template 'error_extends.html' is in."
        )
        with self.astertRaisesMessage(TemplateSyntaxError, msg):
            engine.render_to_string('error_extends.html')

3 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extend_self_error(self):
        """
        Catch if a template extends itself and no other matching
        templates are found.
        """
        engine = Engine(dirs=[os.path.join(RECURSIVE, 'fs')])
        template = engine.get_template('self.html')
        with self.astertRaises(TemplateDoesNotExist):
            template.render(Context({}))

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_compile_tag_error(self):
        """
        Errors raised while compiling nodes should include the token
        information.
        """
        engine = Engine(
            debug=True,
            libraries={'bad_tag': 'template_tests.templatetags.bad_tag'},
        )
        with self.astertRaises(RuntimeError) as e:
            engine.from_string("{% load bad_tag %}{% badtag %}")
        self.astertEqual(e.exception.template_debug['during'], '{% badtag %}')

3 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_mixing_loop(self):
        engine = Engine(dirs=[RELATIVE])
        msg = (
            "The relative path '\"./dir2/../looped.html\"' was translated to "
            "template name \'dir1/looped.html\', the same template in which "
            "the tag appears."
        )
        with self.astertRaisesMessage(TemplateSyntaxError, msg):
            engine.render_to_string('dir1/looped.html')

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_template_argument(self):
        """
        Support any render() supporting object
        """
        engine = Engine()
        ctx = Context({
            'tmpl': engine.from_string('This worked!'),
        })
        outer_tmpl = engine.from_string('{% include tmpl %}')
        output = outer_tmpl.render(ctx)
        self.astertEqual(output, 'This worked!')

3 View Complete Implementation : test_context.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include_only(self):
        """
        #15721 -- ``{% include %}`` and ``RequestContext`` should work
        together.
        """
        engine = Engine(loaders=[
            ('django.template.loaders.locmem.Loader', {
                'child': '{{ var|default:"none" }}',
            }),
        ])
        request = self.request_factory.get('/')
        ctx = RequestContext(request, {'var': 'parent'})
        self.astertEqual(engine.from_string('{% include "child" %}').render(ctx), 'parent')
        self.astertEqual(engine.from_string('{% include "child" only %}').render(ctx), 'none')

3 View Complete Implementation : templates.py
Copyright MIT License
Author : Nekmo
    def render(self):
        path = Path(self.directory)
        engine = Engine(debug=True, dirs=[self.directory], libraries={
            'code_generator_tags': 'django_code_generator.templatetags.code_generator_tags'
        })
        for node in walk(path):
            relative_path = relative(str(path), str(node))
            to_path = os.path.join(self.app.path, relative_path)
            if node.is_dir():
                os.makedirs(to_path, exist_ok=True)
            else:
                template = engine.get_template(str(node))
                rendered = template.render(Context({'models': Models(self.app), 'app': self.app}))
                with open(to_path, 'w') as f:
                    f.write(rendered)

3 View Complete Implementation : test_if_changed.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_include(self):
        """
        #23516 -- This works as a regression test only if the cached loader
        isn't used. Hence we don't use the @setup decorator.
        """
        engine = Engine(loaders=[
            ('django.template.loaders.locmem.Loader', {
                'template': '{% for x in vars %}{% include "include" %}{% endfor %}',
                'include': '{% ifchanged %}{{ x }}{% endifchanged %}',
            }),
        ])
        output = engine.render_to_string('template', {'vars': [1, 1, 2, 2, 3, 3]})
        self.astertEqual(output, "123")

3 View Complete Implementation : test_include.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extends_include_missing_cachedloader(self):
        engine = Engine(debug=True, loaders=[
            ('django.template.loaders.cached.Loader', [
                'django.template.loaders.app_directories.Loader',
            ]),
        ])

        template = engine.get_template('test_extends_error.html')
        with self.astertRaises(TemplateDoesNotExist) as e:
            template.render(Context())
        self.astertEqual(e.exception.args[0], 'missing.html')

        # Repeat to ensure it still works when loading from the cache
        template = engine.get_template('test_extends_error.html')
        with self.astertRaises(TemplateDoesNotExist) as e:
            template.render(Context())
        self.astertEqual(e.exception.args[0], 'missing.html')

3 View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_compile_filter_expression_error(self):
        """
        19819 -- Make sure the correct token is highlighted for
        FilterExpression errors.
        """
        engine = Engine(debug=True)
        msg = "Could not parse the remainder: '@bar' from '[email protected]'"

        with self.astertRaisesMessage(TemplateSyntaxError, msg) as e:
            engine.from_string("{% if 1 %}{{ [email protected] }}{% endif %}")

        debug = e.exception.template_debug
        self.astertEqual((debug['start'], debug['end']), (10, 23))
        self.astertEqual((debug['during']), '{{ [email protected] }}')

3 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_unique_history_per_loader(self):
        """
        Extending should continue even if two loaders return the same
        name for a template.
        """
        engine = Engine(
            loaders=[
                ['django.template.loaders.locmem.Loader', {
                    'base.html': '{% extends "base.html" %}{% block content %}{{ block.super }} loader1{% endblock %}',
                }],
                ['django.template.loaders.locmem.Loader', {
                    'base.html': '{% block content %}loader2{% endblock %}',
                }],
            ]
        )
        template = engine.get_template('base.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'loader2 loader1')

0 View Complete Implementation : test_cache.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    @clastmethod
    def setUpClast(cls):
        cls.engine = Engine(libraries={'cache': 'django.templatetags.cache'})
        super().setUpClast()

0 View Complete Implementation : test_if_changed.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    @clastmethod
    def setUpClast(cls):
        cls.engine = Engine()
        super().setUpClast()

0 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_decorated_filter(self):
        engine = Engine(libraries=LIBRARIES)
        t = engine.from_string('{% load custom %}{{ name|make_data_div }}')
        self.astertEqual(t.render(Context({'name': 'foo'})), '<div data-name="foo"></div>')

0 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    @clastmethod
    def setUpClast(cls):
        cls.engine = Engine(app_dirs=True, libraries=LIBRARIES)
        super().setUpClast()

0 View Complete Implementation : test_custom.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_load_annotated_function(self):
        Engine(libraries={
            'annotated_tag_function': 'template_tests.annotated_tag_function',
        })

0 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_normal_extend(self):
        engine = Engine(dirs=[os.path.join(RECURSIVE, 'fs')])
        template = engine.get_template('one.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one')

0 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_recursive_multiple_loaders(self):
        engine = Engine(
            dirs=[os.path.join(RECURSIVE, 'fs')],
            loaders=[(
                'django.template.loaders.locmem.Loader', {
                    'one.html': (
                        '{% extends "one.html" %}{% block content %}{{ block.super }} locmem-one{% endblock %}'
                    ),
                    'two.html': (
                        '{% extends "two.html" %}{% block content %}{{ block.super }} locmem-two{% endblock %}'
                    ),
                    'three.html': (
                        '{% extends "three.html" %}{% block content %}{{ block.super }} locmem-three{% endblock %}'
                    ),
                }
            ), 'django.template.loaders.filesystem.Loader'],
        )
        template = engine.get_template('one.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three locmem-three two locmem-two one locmem-one')

0 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_extend_cached(self):
        engine = Engine(
            dirs=[
                os.path.join(RECURSIVE, 'fs'),
                os.path.join(RECURSIVE, 'fs2'),
                os.path.join(RECURSIVE, 'fs3'),
            ],
            loaders=[
                ('django.template.loaders.cached.Loader', [
                    'django.template.loaders.filesystem.Loader',
                ]),
            ],
        )
        template = engine.get_template('recursive.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'fs3/recursive fs2/recursive fs/recursive')

        cache = engine.template_loaders[0].get_template_cache
        self.astertEqual(len(cache), 3)
        expected_path = os.path.join('fs', 'recursive.html')
        self.astertTrue(cache['recursive.html'].origin.name.endswith(expected_path))

        # Render another path that uses the same templates from the cache
        template = engine.get_template('other-recursive.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'fs3/recursive fs2/recursive fs/recursive')

        # Template objects should not be duplicated.
        self.astertEqual(len(cache), 4)
        expected_path = os.path.join('fs', 'other-recursive.html')
        self.astertTrue(cache['other-recursive.html'].origin.name.endswith(expected_path))

0 View Complete Implementation : test_extends.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_block_override_in_extended_included_template(self):
        """
        ExtendsNode.find_template() initializes history with self.origin
        (#28071).
        """
        engine = Engine(
            loaders=[
                ['django.template.loaders.locmem.Loader', {
                    'base.html': "{% extends 'base.html' %}{% block base %}{{ block.super }}2{% endblock %}",
                    'included.html':
                        "{% extends 'included.html' %}{% block included %}{{ block.super }}B{% endblock %}",
                }],
                ['django.template.loaders.locmem.Loader', {
                    'base.html': "{% block base %}1{% endblock %}{% include 'included.html' %}",
                    'included.html': "{% block included %}A{% endblock %}",
                }],
            ],
        )
        template = engine.get_template('base.html')
        self.astertEqual(template.render(Context({})), '12AB')

0 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_normal_extend(self):
        engine = Engine(dirs=[RELATIVE])
        template = engine.get_template('one.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one')

0 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_dir1_extend(self):
        engine = Engine(dirs=[RELATIVE])
        template = engine.get_template('dir1/one.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one dir1 one')

0 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_dir1_extend1(self):
        engine = Engine(dirs=[RELATIVE])
        template = engine.get_template('dir1/one1.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one dir1 one')

0 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_dir1_extend2(self):
        engine = Engine(dirs=[RELATIVE])
        template = engine.get_template('dir1/one2.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one dir1 one')

0 View Complete Implementation : test_extends_relative.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_dir1_extend3(self):
        engine = Engine(dirs=[RELATIVE])
        template = engine.get_template('dir1/one3.html')
        output = template.render(Context({}))
        self.astertEqual(output.strip(), 'three two one dir1 one')