ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/jinja2/testsuite/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/jinja2/testsuite/regression.pyo

�
,��Qc@s�dZddlZddlmZddlmZmZmZmZm	Z	m
Z
ddlmZe�Z
defd��YZdefd	��YZd
�ZdS(s�
    jinja2.testsuite.regression
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Tests corner cases and bugs.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCase(tTemplatetEnvironmentt
DictLoadertTemplateSyntaxErrortTemplateNotFoundtPrefixLoader(t	text_typetCornerTestCasecBseZd�Zd�ZRS(cCs1tjd�}tjd�}tjd�}dS(Nsv
        {%- for item in (1, 2, 3, 4) -%}
            [{{ item }}]
        {%- endfor %}
        {{- item -}}
        s�
        {%- for item in (1, 2, 3, 4) -%}
            [{{ item }}]
        {%- endfor %}
        {%- set item = 42 %}
        {{- item -}}
        s�
        {%- set item = 42 %}
        {%- for item in (1, 2, 3, 4) -%}
            [{{ item }}]
        {%- endfor %}
        {{- item -}}
        (tenvtfrom_string(tselftt((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_assigned_scopings			cCs1tjd�}tjd�}tjd�}dS(Ns�
        {%- set wrapper = "<FOO>" %}
        {%- for item in (1, 2, 3, 4) %}
            {%- macro wrapper() %}[{{ item }}]{% endmacro %}
            {{- wrapper() }}
        {%- endfor %}
        {{- wrapper -}}
        s�
        {%- for item in (1, 2, 3, 4) %}
            {%- macro wrapper() %}[{{ item }}]{% endmacro %}
            {{- wrapper() }}
        {%- endfor %}
        {%- set wrapper = "<FOO>" %}
        {{- wrapper -}}
        s�
        {%- for item in (1, 2, 3, 4) %}
            {%- macro wrapper() %}[{{ item }}]{% endmacro %}
            {{- wrapper() }}
        {%- endfor %}
        {{- wrapper -}}
        (R	R
(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_closure_scoping3s			(t__name__t
__module__R
R(((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyRs	tBugTestCasecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(cCst�}d�|jd<dS(NcSs||S(N((tvaluetsome((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt<lambda>Vsttesting(Rtfilters(RR	((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_keyword_foldingTs	cCs/tdtidd6��}|jd�}dS(Ntloaders#(({% block title %}{% endblock %}))sparent.htmls�{% if expr %}{% extends "parent.html" %}{% endif %}[[{% block title %}title{% endblock %}]]{% for item in [1, 2, 3] %}({{ item }}){% endfor %}(RRR
(RR	R((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_extends_output_bugsZscCstjd�}dS(Ns*{{ "http://www.example.org/<foo"|urlize }}(R	R
(Rttmpl((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_urlize_filter_escapingescCstjd�}dS(Ns7

        {% macro test() %}
            {{ caller() }}
        {% endmacro %}

        {% for num1 in range(5) %}
            {% call test() %}
                {% for num2 in range(10) %}
                    {{ loop.index }}
                {% endfor %}
            {% endcall %}
        {% endfor %}

        (R	R
(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_loop_call_loopis	cCs)tdd�}|jt|jd�dS(Ntline_statement_prefixt%s+% for item in seq {# missing #}
...% endfor(Rt
assert_raisesRR
(RR	((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_weird_inline_comment|scCstjd�}dS(NsO{% for i in (1, 2) %}{{ i }}{% endfor %}{% macro i() %}3{% endmacro %}{{ i() }}(R	R
(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_old_macro_loop_scoping_bug�scCstjd�}dS(Ns,{% if b %}{% set a = 42 %}{% endif %}{{ a }}(R	R
(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt$test_partial_conditional_assignments�scCs"tdd�}|jd�}dS(NRt#s�# for j in [1, 2]:
#   set x = 1
#   for i in [1, 2]:
#     print x
#     if i % 2 == 0:
#       set x = x + 1
#     endif
#   endfor
# endfor
# if a
#   print 'A'
# elif b
#   print 'B'
# elif c == d
#   print 'C'
# else
#   print 'D'
# endif
    (RR
(RR	R((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_stacked_locals_scoping_bug�s	cCs+td�}|jddg�j�}dS(Ns�
            {% set x = 1 %}
            {% for item in foo %}
                {% if item == 1 %}
                    {% set x = 2 %}
                {% endif %}
            {% endfor %}
            {{ x }}
        tfooi(Rtrendertstrip(RRtrv((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt(test_stacked_locals_scoping_bug_twoframe�s	cCstd�}dS(Ns�{% macro dump_users(users) -%}
        <ul>
          {%- for user in users -%}
            <li><p>{{ user.username|e }}</p>{{ caller(user) }}</li>
          {%- endfor -%}
          </ul>
        {%- endmacro -%}

        {% call(user) dump_users(list_of_user) -%}
          <dl>
            <dl>Realname</dl>
            <dd>{{ user.realname|e }}</dd>
            <dl>Description</dl>
            <dd>{{ user.description }}</dd>
          </dl>
        {% endcall %}(R(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_call_with_args�s	cCs=|jttd�|jttd�|jttd�dS(Ns{% if %}....{% endif %}s'{% if foo %}...{% elif %}...{% endif %}s{% for x in %}..{% endfor %}(RRR(R((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_empty_if_condition_fails�scCstd�}td�}dS(Ns3
        {% for p in foo recursive%}
            {{p.bar}}
            {% for f in p.fields recursive%}
                {{f.baz}}
                {{p.bar}}
                {% if f.rec %}
                    {{ loop(f.sub) }}
                {% endif %}
            {% endfor %}
        {% endfor %}
        s)
        {% for p in foo%}
            {{p.bar}}
            {% for f in p.fields recursive%}
                {{f.baz}}
                {{p.bar}}
                {% if f.rec %}
                    {{ loop(f.sub) }}
                {% endif %}
            {% endfor %}
        {% endfor %}
        (R(Rttpl1ttpl2((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_recursive_loop_bug�s	cCs2td�}|j|jdg�j�d�dS(Ns�
            {% for x in y %}
                {{ loop.index0 }}
            {% else %}
                {% for i in range(3) %}{{ i }}{% endfor %}
            {% endfor %}
        tyt012(RtassertEqualR&R'(RR((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_else_loop_bug�s	cCsMtdtiti�d6��}y|jd�Wntk
rH}nXdS(NRR%sfoo/bar.html(RRRtget_templateR(RR	te((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyttest_correct_prefix_loader_name�scsmddlm�dtf�fd��Y}td�}|jd|�dd�}d}|j||�dS(	Ni����(tcontextfunctiont
CallableClasscseZ�d��ZRS(cSs
|jd�S(Nthello(tresolve(Rtctx((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt__call__s(RRR;((R6(s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyR7ss{{ callableclass() }}t
callableclassR8tTEST(tjinja2.utilsR6tobjectRR&tassert_equal(RR7ttpltoutputtexpected((R6s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt%test_contextfunction_callable_classess(RRRRRRR R!R"R$R)R*R+R.R2R5RD(((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyRRs									
	 			
	cCs<tj�}|jtjt��|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteRR(tsuite((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyRIs(t__doc__REtjinja2.testsuiteRtjinja2RRRRRRtjinja2._compatRR	RRRI(((s?/usr/lib/python2.7/site-packages/jinja2/testsuite/regression.pyt<module>
s.	<�

Zerion Mini Shell 1.0