ok

Mini Shell

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

�
��Rc@s�dZddlZddlZddlmZddlmZmZmZm	Z	ddl
mZddlm
Z
ddlmZmZddlmZmZmZmZd	Zejd
�Zidd6d
d6dd6dd6dd6Zidd6d
d6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6Ziid&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d66Zed7��Zed8��Zed9ee�d:d;g�Zejj ied<6ed=6ed>6�ed9ee�d:d;g�Z!e!j"eed?e#�d@e
fdA��YZ$dBe
fdC��YZ%dDe
fdE��YZ&dFefdG��YZ'dHefdI��YZ(dJefdK��YZ)dLefdM��YZ*dN�Z+dS(Os�
    jinja2.testsuite.ext
    ~~~~~~~~~~~~~~~~~~~~

    Tests for the extensions.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCase(tEnvironmentt
DictLoadertcontextfunctiontnodes(tTemplateAssertionError(t	Extension(tTokentcount_newlines(tnexttBytesIOt
itervaluest	text_typeis_\((.*?)\)(?s)sS<title>{{ page_title|default(_("missing")) }}</title>{% block body %}{% endblock %}smaster.htmls[{% extends "master.html" %}{% block body %}{% trans %}watch out{% endtrans %}{% endblock %}s
child.htmls_{% trans user_count %}One user online{% pluralize %}{{ user_count }} users online{% endtrans %}splural.htmlsf{% trans user_count=get_user_count() %}{{ user_count }}s{% pluralize %}{{ user_count }}p{% endtrans %}splural2.htmls/{{ _("User: %(num)s")|format(num=user_count) }}sstringformat.htmls({{ _("User: %(num)s", num=user_count) }}s9{{ ngettext("%(num)s apple", "%(num)s apples", apples) }}s
ngettext.htmlsR{% trans num=apples %}{{ num }} apple{% pluralize %}{{ num }} apples{% endtrans %}sngettext_long.htmls({% trans %}User: {{ num }}{% endtrans %}stransvars1.htmls2{% trans num=count %}User: {{ num }}{% endtrans %}stransvars2.htmls4{% trans count=num %}User: {{ count }}{% endtrans %}stransvars3.htmls"{% trans %}%(hello)s{% endtrans %}snovars.htmls){% trans %}{{ foo }}%(foo)s{% endtrans %}s	vars.htmls){% trans foo="42" %}%(foo)s{% endtrans %}sexplicitvars.htmlufehlendtmissingupass aufs	watch outuEin Benutzer onlinesOne user onlineu%(user_count)s Benutzer onlines%(user_count)s users onlineuBenutzer: %(num)ss
User: %(num)suBenutzer: %(count)ssUser: %(count)su
%(num)s Apfels
%(num)s appleu%(num)s Äpfels%(num)s applestdecCs.|jdd�}tj|i�j||�S(NtLANGUAGEten(tgett	languages(tcontexttstringtlanguage((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pytgettextIscCsV|jdd�}|dkr:tj|i�j||�Stj|i�j||�S(NRRi(RR(RtstptnR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pytngettextOstloadert
extensionssjinja2.ext.i18nt_RRtnewstylet
TestExtensioncBs/eZedg�ZdZd�Zd�ZRS(ttesti*cCsbtj|jdtjd�|jd�tjtd�tj�g�g�jt	|j
�j�S(Nt_dumpt	sandboxedtext_attrs.importable_object(RtOutputtcall_methodtEnvironmentAttributetattrtImportedNamet__name__tContextReferencet
set_linenoR	tstreamtlineno(tselftparser((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pytparsekscCsd||||jfS(Ns%s|%s|%s|%s(tblocks(R.R"R#timported_objectR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR!ss
(R)t
__module__tsetttagsR#R0R!(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRgs	tPreprocessorExtensioncBseZdd�ZRS(cCs|jdd�S(Ns[[TEST]]s({{ foo }})(treplace(R.tsourcetnametfilename((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt
preprocess~sN(R)R3tNoneR;(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR6|stStreamFilterExtensioncBseZd�Zd�ZRS(ccsKxD|D]<}|jdkr>x$|j|�D]}|Vq,Wq|VqWdS(Ntdata(ttypetinterpolate(R.R,ttokentt((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt
filter_stream�s

ccs2d}t|j�}|j}x�tj|j|�}|dkrFPn|j||j�!}|rvt|d|�Vn|t|j�7}t|dd�Vt|dd�Vt|dd�Vt|d|j	d��Vt|d	d�Vt|d
d�V|j
�}q!||kr.t|d|j|�VndS(NiR>tvariable_beginR9RtlparenRitrparentvariable_end(tlentvalueR-t_gettext_retsearchR<tstartRRtgrouptend(R.RAtposRNR-tmatchRI((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR@�s(	(R)R3RCR@(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR=�s	tExtensionsTestCasecBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs)t�}|jd�|jd�}dS(Nsjinja2.ext.autoescapes6{% autoescape true %}{{ "<test>" }}{% endautoescape %}(Rt
add_extensiontfrom_string(R.tenvRB((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_extend_late�s	
cCs4tddg�}|jd�}|jd�}dS(NRsjinja2.ext.loopcontrolss�
            {%- for item in [1, 2, 3, 4] %}
                {%- if item % 2 == 0 %}{% continue %}{% endif -%}
                {{ item }}
            {%- endfor %}s�
            {%- for item in [1, 2, 3, 4] %}
                {%- if item > 2 %}{% break %}{% endif -%}
                {{ item }}
            {%- endfor %}(RRS(R.RTttmpl((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_loop_controls�s		cCs%tddg�}|jd�}dS(NRs
jinja2.ext.dos�
            {%- set items = [] %}
            {%- for char in "foo" %}
                {%- do items.append(loop.index0 ~ char) %}
            {%- endfor %}{{ items|join(', ') }}(RRS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_do�s	cCs%tddg�}|jd�}dS(NRsjinja2.ext.with_sy        {% with a=42, b=23 -%}
            {{ a }} = {{ b }}
        {% endwith -%}
            {{ a }} = {{ b }}        (RRS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt	test_with�s	cCs%tdtg�}|jd�}dS(NRs
{% test %}(RRRS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_extension_nodes�scCsdS(N((R.((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_identifier�scCsStdtg�}|j�}x.||fD] }xt|j�D]}qAWq+WdS(NR(RRtoverlayRR(R.toriginalR\RTtext((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_rebinding�s
cCs%tdtg�}|jd�}dS(NRs
{[[TEST]]}(RR6RS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_preprocessor_extension�scCsAtdtg�}d�|jd<|jd�}|j�}dS(NRcSs
|j�S(N(tupper(tx((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt<lambda>�sRsFoo _(bar) Baz(RR=tglobalsRStrender(R.RTRVtout((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_streamfilter_extension�s
cCsWdtfd��Y}dtfd��Y}td||g�}t|j��}dS(NtT1cBseZdZRS(i(R)R3tpriority(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRh�stT2cBseZdZRS(i(R)R3Ri(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRj�sR(RRtlisttiter_extensions(R.RhRjRTR^((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_extension_ordering�s
(R)R3RURWRXRYRZR[R_R`RgRm(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRQ�s										tInternationalizationTestCasecBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCstjd�}dS(Ns
child.html(ti18n_envtget_template(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt
test_trans�scCstjd�}dS(Nsplural.html(RoRp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_trans_plural�scs+tjd�}�fd��d�_dS(Nsplural2.htmlcs�jd7_dS(Ni(tcalled((tget_user_count(s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRtsi(RoRpRs(R.RV((Rts8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt test_trans_plural_with_functionss	cCs)tjd�}|jttjd�dS(Ns_{% trans foo=42, count=2 %}{{ count }} item{% pluralize count %}{{ count }} items{% endtrans %}s6{% trans foo %}...{% pluralize bar %}...{% endtrans %}(RoRSt
assert_raisesR(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_complex_plural
scCstjd�}dS(Nsstringformat.html(RoRp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_trans_stringformattingscCs)ddlm}tdjd��}dS(Ni����(t
babel_extracts�
        {{ gettext('Hello World') }}
        {% trans %}Hello World{% endtrans %}
        {% trans %}{{ users }} user{% pluralize %}{{ users }} users{% endtrans %}
        tascii(t
jinja2.extRyR
tencode(R.RyR8((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_extractscCs)ddlm}tdjd��}dS(Ni����(Rys�
        {# trans first #}
        {{ gettext('Hello World') }}
        {% trans %}Hello World{% endtrans %}{# trans second #}
        {#: third #}
        {% trans %}{{ users }} user{% pluralize %}{{ users }} users{% endtrans %}
        sutf-8(R{RyR
R|(R.RyR8((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_comment_extract"s(	R)R3RqRrRuRwRxR}R~(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRn�s							
t$NewstyleInternationalizationTestCasecBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCstjd�}dS(Ns
child.html(tnewstyle_i18n_envRp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRq4scCstjd�}dS(Nsplural.html(R�Rp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRr8scCs)tjd�}|jttjd�dS(Ns_{% trans foo=42, count=2 %}{{ count }} item{% pluralize count %}{{ count }} items{% endtrans %}s6{% trans foo %}...{% pluralize bar %}...{% endtrans %}(R�RSRvRRo(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRw=scCstjd�}dS(Nsstringformat.html(R�Rp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRxDscCstjd�}dS(Ns
ngettext.html(R�Rp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_newstyle_pluralHscCsDtdddg�}|jd�d�dt�|jd�}dS(NRsjinja2.ext.autoescapesjinja2.ext.i18ncSsdS(Nu<strong>Wert: %(name)s</strong>((Rb((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRcPscSs|S(N((RRR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyRcQsRsI{% autoescape ae %}{{ gettext("foo", name="<test>") }}{% endautoescape %}(Rtinstall_gettext_callablestTrueRS(R.RTRB((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_autoescape_supportMs	cCstjd�}dS(Nsngettext_long.html(R�Rp(R.RV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_num_used_twiceWscCstjddt�}dS(Nso
            {% trans num=3 %}{{ num }} apple{% pluralize
            %}{{ num }} apples{% endtrans %}
        traw(R�tcompileR�(R.R8((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_num_called_num[scCs1tjd�}tjd�}tjd�}dS(Nstransvars1.htmlstransvars2.htmlstransvars3.html(R�Rp(R.tt1tt2tt3((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_trans_varsgscCs1tjd�}tjd�}tjd�}dS(Nsnovars.htmls	vars.htmlsexplicitvars.html(R�Rp(R.RB((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_novars_vars_escapingos(R)R3RqRrRwRxR�R�R�R�R�R�(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR2s						
			tAutoEscapeTestCasecBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsRtddgdt�}|jd�}tddgdt�}|jd�}dS(NRsjinja2.ext.autoescapet
autoescapes�
            {{ "<HelloWorld>" }}
            {% autoescape false %}
                {{ "<HelloWorld>" }}
            {% endautoescape %}
            {{ "<HelloWorld>" }}
        s�
            {{ "<HelloWorld>" }}
            {% autoescape true %}
                {{ "<HelloWorld>" }}
            {% endautoescape %}
            {{ "<HelloWorld>" }}
        (RR�RStFalse(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_scoped_settingzs				cCs:tddgdt�}|jd�}|jd�}dS(NRsjinja2.ext.autoescapeR�s&{{ {"foo": "<test>"}|xmlattr|escape }}sO{% autoescape false %}{{ {"foo": "<test>"}|xmlattr|escape }}{% endautoescape %}(RR�RS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_nonvolatile�s
	cCs+tddgdt�}|jd�}dS(NRsjinja2.ext.autoescapeR�sM{% autoescape foo %}{{ {"foo": "<test>"}|xmlattr|escape }}{% endautoescape %}(RR�RS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt
test_volatile�s	cCs%tddg�}|jd�}dS(NRsjinja2.ext.autoescapesT{% autoescape true %}{% set x = "<x>" %}{{ x }}{% endautoescape %}{{ x }}{{ "<y>" }}(RRS(R.RTRV((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_scoping�scCstddg�}d}|j|�}tddg�}|j|dt�}tddgdt�}|j|dt�}dS(NRsjinja2.ext.autoescapes�
        {% autoescape val %}
            {% macro foo(x) %}
                [{{ x }}]
            {% endmacro %}
            {{ foo().__class__.__name__ }}
        {% endautoescape %}
        {{ '<testing>' }}
        R�R�(RRSR�R�(R.RTt
tmplsourceRVtpysource((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyttest_volatile_scoping�s		(R)R3R�R�R�R�R�(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR�xs
					cCshtj�}|jtjt��|jtjt��|jtjt��|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteRQRnRR�(tsuite((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyR��s(,t__doc__treR�tjinja2.testsuiteRtjinja2RRRRtjinja2.exceptionsRR{Rtjinja2.lexerRRtjinja2._compatR	R
RRtimportable_objectR�RJti18n_templatestnewstyle_i18n_templatesRRRRoRdtupdateR�R�R�RR6R=RQRnRR�R�(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/ext.pyt<module>
sx""

!S<FM

Zerion Mini Shell 1.0