ok

Mini Shell

Direktori : /lib/python2.7/site-packages/jinja2/testsuite/
Upload File :
Current File : //lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyc

�
,��Qc@s�dZddlZddlmZddlmZmZmZdZdZ	dZ
dZd	Zd
Z
dZedeied
6e	d6e
d6ed6ed6e
d6ed6�de�Zdefd��YZdefd��YZd�ZdS(s�
    jinja2.testsuite.inheritance
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Tests the template inheritance feature.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCase(tEnvironmentt
DictLoadert
TemplateErrors�|{% block block1 %}block 1 from layout{% endblock %}
|{% block block2 %}block 2 from layout{% endblock %}
|{% block block3 %}
{% block block4 %}nested block 4 from layout{% endblock %}
{% endblock %}|sJ{% extends "layout" %}
{% block block1 %}block 1 from level1{% endblock %}sq{% extends "level1" %}
{% block block2 %}{% block block5 %}nested block 5 from level2{%
endblock %}{% endblock %}s{% extends "level2" %}
{% block block5 %}block 5 from level3{% endblock %}
{% block block4 %}block 4 from level3{% endblock %}
sK{% extends "level3" %}
{% block block3 %}block 3 from level4{% endblock %}
s�{% extends "layout" %}
{% block block1 %}
  {% if false %}
    {% block block2 %}
      this should workd
    {% endblock %}
  {% endif %}
{% endblock %}
s�{% extends "layout" %}
{% extends "layout" %}
{% block block1 %}
  {% if false %}
    {% block block2 %}
      this should workd
    {% endblock %}
  {% endif %}
{% endblock %}
tloadertlayouttlevel1tlevel2tlevel3tlevel4tworkingtdoubleettrim_blockstInheritanceTestCasecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(cCs+tjd�}|j�dks't�dS(NRsD|block 1 from layout|block 2 from layout|nested block 4 from layout|(tenvtget_templatetrendertAssertionError(tselfttmpl((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_layoutRscCs+tjd�}|j�dks't�dS(NRsD|block 1 from level1|block 2 from layout|nested block 4 from layout|(RRRR(RR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_level1WscCs+tjd�}|j�dks't�dS(NRsK|block 1 from level1|nested block 5 from level2|nested block 4 from layout|(RRRR(RR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_level2\scCs+tjd�}|j�dks't�dS(NRs=|block 1 from level1|block 5 from level3|block 4 from level3|(RRRR(RR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_level3ascCs+tjd�}|j�dks't�dS(NR	s=|block 1 from level1|block 5 from level3|block 3 from level4|(RRRR(tselR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_level4fscCsUtdtidd6dd6dd6��}|jd�}|j�dksQt�dS(	NRsU{% block intro %}INTRO{% endblock %}|BEFORE|{% block data %}INNER{% endblock %}|AFTERtas>{% extends "a" %}{% block data %}({{ super() }}){% endblock %}tbso{% extends "b" %}{% block intro %}--{{ super() }}--{% endblock %}
{% block data %}[{{ super() }}]{% endblock %}tcs --INTRO--|BEFORE|[(INNER)]|AFTER(RRRRR(RRR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyt
test_superkscCstjd�}dS(NR
(RR(RR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_workingxscCs+tjd�}|j�dks't�dS(NsA{{ self.foo() }}|{% block foo %}42{% endblock %}|{{ self.foo() }}s42|42|42(Rtfrom_stringRR(RR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_reuse_blocks{scCsNtdtidd6dd6��}|jd�}|j�dksJt�dS(NRsC{% if false %}{% block x %}A{% endblock %}{% endif %}{{ self.x() }}Rs:{% extends "a" %}{% block x %}B{{ super() }}{% endblock %}RtBA(RRRRR(RRR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_preserve_blocks�s
cCs}tdtidd6dd6dd6��}|jd�}x=tdd	�D],}|jd
d|�d|ksIt�qIWdS(
NRs"MASTER1{% block x %}{% endblock %}tmaster1s"MASTER2{% block x %}{% endblock %}tmaster2s4{% extends master %}{% block x %}CHILD{% endblock %}tchildiitmastersmaster%ds
MASTER%dCHILD(RRRtrangeRR(RRRtm((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_dynamic_inheritance�scCs�tdtidd6dd6dd6��}|jd�}|jdd�d	ksWt�|jdd�d
ksut�|j�d
ks�t�dS(NRs"MASTER1{% block x %}{% endblock %}R#s"MASTER2{% block x %}{% endblock %}R$s�{% if master %}{% extends master %}{% else %}{% extends
                        'master1' %}{% endif %}{% block x %}CHILD{% endblock %}R%R&tMASTER2CHILDtMASTER1CHILD(RRRRR(RRR((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_multi_inheritance�scCsYtdtidd6��}|jd�}|jdttd���dksUt�dS(NRsH{% for item in seq %}[{% block item scoped %}{% endblock %}]{% endfor %}smaster.htmlsC{% extends "master.html" %}{% block item %}{{ item }}{% endblock %}tseqis[0][1][2][3][4](RRRRtlistR'R(RRtt((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_scoped_block�scCsYtdtidd6��}|jd�}|jdttd���dksUt�dS(NRsR{% for item in seq %}[{% block item scoped %}{{ item }}{% endblock %}]{% endfor %}smaster.htmlsU{% extends "master.html" %}{% block item %}{{ super() }}|{{ item * 2 }}{% endblock %}R-is[0|0][1|2][2|4][3|6][4|8](RRRRR.R'R(RRR/((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_super_in_scoped_block�scCsjtdtidd6dd6dd6��}|jd�jdd	�j�}|d
ddgksft�dS(
NRs;
            {% block useless %}{% endblock %}
            slayout.htmlsl
            {%- extends 'layout.html' %}
            {% from 'helpers.html' import foo with context %}
            {% block useless %}
                {% for x in [1, 2, 3] %}
                    {% block testing scoped %}
                        {{ foo(x) }}
                    {% endblock %}
                {% endfor %}
            {% endblock %}
            s
index.htmlsK
            {% macro foo(x) %}{{ the_foo + x }}{% endmacro %}
            shelpers.htmltthe_fooi*t43t44t45(RRRRtsplitR(RRtrv((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyt#test_scoped_block_after_inheritance�s!(t__name__t
__module__RRRRRRRR R"R)R,R0R1R8(((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyR
Ps						
				
					tBugFixTestCasecBseZd�Zd�ZRS(cCsUtdtidd6dd6dd6��jd�j�j�dd	gksQt�dS(
NRs�        {% extends 'details.html' %}

        {% macro my_macro() %}
        my_macro
        {% endmacro %}

        {% block inner_box %}
            {{ my_macro() }}
        {% endblock %}
            s	test.htmlsd        {% extends 'standard.html' %}

        {% macro my_macro() %}
        my_macro
        {% endmacro %}

        {% block content %}
            {% block outer_box %}
                outer_box
                {% block inner_box %}
                    inner_box
                {% endblock %}
            {% endblock %}
        {% endblock %}
        sdetails.htmls9
        {% block content %} {% endblock %}
        s
standard.htmlu	outer_boxumy_macro(RRRRR6R(R((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_fixed_macro_scoping_bug�s
cCsBytjd�}Wn(tk
r=}t|t�s>t�nXdS(smEnsures that a template with more than 1 {% extends ... %} usage
        raises a ``TemplateError``.
        RN(RRt	Exceptiont
isinstanceRR(RRte((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyttest_double_extends�s(R9R:R<R@(((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyR;�s	"cCs<tj�}|jtjt��|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteR
R;(tsuite((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyRE�s(t__doc__RAtjinja2.testsuiteRtjinja2RRRtLAYOUTTEMPLATEtLEVEL1TEMPLATEtLEVEL2TEMPLATEtLEVEL3TEMPLATEtLEVEL4TEMPLATEtWORKINGTEMPLATEt
DOUBLEEXTENDStTrueRR
R;RE(((s@/usr/lib/python2.7/site-packages/jinja2/testsuite/inheritance.pyt<module>
s,
	x.

Zerion Mini Shell 1.0