ok

Mini Shell

Direktori : /lib/python2.7/site-packages/jinja2/testsuite/
Upload File :
Current File : //lib/python2.7/site-packages/jinja2/testsuite/imports.pyo

�
~KRc
@s�dZddlZddlmZddlmZmZddlmZm	Z	edee
ddd	d
dd���Zd
ejd<defd��YZ
defd��YZd�ZdS(s�
    jinja2.testsuite.imports
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Tests the import features (with includes).

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCase(tEnvironmentt
DictLoader(tTemplateNotFoundtTemplatesNotFoundtloadertmodules5{% macro test() %}[{{ foo }}|{{ bar }}]{% endmacro %}theaders[{{ foo }}|{{ 23 }}]t	o_printers	({{ o }})itbartImportsTestCasecBs#eZd�Zd�Zd�ZRS(cCs^tjd�}tjd�}tjd�}tjd�}tjd�}tjd�}dS(Ns({% import "module" as m %}{{ m.test() }}s8{% import "module" as m without context %}{{ m.test() }}s5{% import "module" as m with context %}{{ m.test() }}s+{% from "module" import test %}{{ test() }}s;{% from "module" import test without context %}{{ test() }}s8{% from "module" import test with context %}{{ test() }}(ttest_envtfrom_string(tselftt((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_context_importsscCsEtjd�tjd�tjd�tjd�tjd�dS(Ns-{% from "foo" import bar, baz with context %}s.{% from "foo" import bar, baz, with context %}s){% from "foo" import bar, with context %}s*{% from "foo" import bar, with, context %}s.{% from "foo" import bar, with with context %}(RR(R
((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_trailing_comma+s




cCstjd�j}dS(Ns
            {% macro toplevel() %}...{% endmacro %}
            {% macro __private() %}...{% endmacro %}
            {% set variable = 42 %}
            {% for item in [1] %}
                {% macro notthere() %}{% endmacro %}
            {% endfor %}
        (RRR(R
tm((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_exports2s(t__name__t
__module__RRR(((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyR
s		tIncludesTestCasecBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs1tjd�}tjd�}tjd�}dS(Ns{% include "header" %}s#{% include "header" with context %}s&{% include "header" without context %}(RR(R
R((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_context_includeCscCs+tjd�}tjd�}tjd�}|jt|j�y|j�Wntk
rc}nXd�}tjd�}||�tjd�}||dddg�tjd	�}||dd�tjd�}||dd�tjd�}||dd�tjd
�}||dd�dS(Ns#{% include ["missing", "header"] %}s4{% include ["missing", "missing2"] ignore missing %}s%{% include ["missing", "missing2"] %}c[sd|d<dS(Ni*tfoo((Rtctx((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyt
test_includes\s
s{% include x %}txtmissingRs{% include [x, "header"] %}s{% include [x] %}(RRt
assert_raisesRtrenderR(R
RteR((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_choice_includesKs*	
cCsNtjd�}|jt|j�x%dD]}tjd|d�}q)WdS(Ns{% include "missing" %}tswith contextswithout contexts${% include "missing" ignore missing s %}(R swith contextswithout context(RRRRR(R
Rtextra((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_include_ignoring_missingms
cCs(tdttdddd���}dS(NRtmains;{% for item in [1, 2, 3] %}{% include 'item' %}{% endfor %}titems
{{ item }}(RRtdict(R
tenv((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyt#test_context_include_with_overridesuscCstjd�}dS(Ns�
            {% macro outer(o) %}
            {% macro inner() %}
            {% include "o_printer" %}
            {% endmacro %}
            {{ inner() }}
            {% endmacro %}
            {{ outer("FOO") }}
        (RR(R
R((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyttest_unoptimized_scopes|s	(RRRRR"R'R((((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyRAs
		"		cCs<tj�}|jtjt��|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteR
R(tsuite((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyR-�s(t__doc__R)tjinja2.testsuiteRtjinja2RRtjinja2.exceptionsRRR%RtglobalsR
RR-(((s</usr/lib/python2.7/site-packages/jinja2/testsuite/imports.pyt<module>
s
&H

Zerion Mini Shell 1.0