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/api.pyo

�
��Rc@sdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZmZddlmZe
�Zdefd��YZd	efd
��YZdefd��YZd
efd��YZd�ZdS(s�
    jinja2.testsuite.api
    ~~~~~~~~~~~~~~~~~~~~

    Tests the public API and related stuff.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCase(tnext(	tEnvironmentt	UndefinedtDebugUndefinedtStrictUndefinedtUndefinedErrortmetatis_undefinedtTemplatet
DictLoader(tCyclertExtendedAPITestCasecBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs^ddlm}xGt�|�fD]3}|jd�}|jd�}|jd�}q#WdS(Ni����(tSandboxedEnvironments{{ foo.items()|list }}s{{ foo|attr("items")()|list }}s{{ foo["items"] }}(tjinja2.sandboxR
Rtfrom_string(tselfR
tenvttmpl((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_item_and_attributescCs:d�}td|�}|jd�}|jd�}dS(NcSs|dkrd}n|S(Nu(tNone(tvalue((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pytfinalize_none_empty*s	tfinalizes,{% for item in seq %}|{{ item }}{% endfor %}s<{{ none }}>(RR(RRRR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_finalizer)s
	cCs?d}t|�}x||D]}qWt|�|j�dS(Niii(iii(RRtreset(Rtitemstctitem((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_cycler4s

cCs7tjd�}tjddt�}tjd�}dS(Ntfootundefined_to_nones42 + foo(Rtcompile_expressiontFalse(Rtexprtexpr2((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_expressions?scCstd�}dS(NtContent(R	(Rtt((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_template_passthroughIscCscd�}td|dtidd6dd6��}|jd�}|jd�}|jd�}dS(NcSs)|dksd|krtS|jd�S(Nt.s.html(RR!tendswith(tname((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pytselect_autoescapeQst
autoescapetloaders	{{ foo }}stest.txts	test.html(RR
tget_templateR(RR+RR&((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_autoescape_autoselectPs	(t__name__t
__module__RRRR$R'R/(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyRs				
	tMetaTestCasecBs#eZd�Zd�Zd�ZRS(cCs@tjd�}tj|�}tjd�}tj|�}dS(Ns!{% set foo = 42 %}{{ bar + foo }}s�{% set foo = 42 %}{{ bar + foo }}{% macro meh(x) %}{{ x }}{% endmacro %}{% for item in seq %}{{ muh(item) + meh(seq) }}{% endfor %}(RtparseRtfind_undeclared_variables(Rtasttx((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_find_undeclared_variablesds
cCs@tjd�}tj|�}tjd�}tj|�}dS(Ns/{% extends "layout.html" %}{% include helper %}sx{% extends "layout.html" %}{% from "test.html" import a, b as c %}{% import "meh.html" as meh %}{% include "muh.html" %}(RR3Rtfind_referenced_templates(RR5ti((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyt test_find_refererenced_templatesos
cCs|tjd�}tj|�}tjd�}tj|�}tjd�}tj|�}tjd�}tj|�}dS(Ns&{% include ["foo.html", "bar.html"] %}s&{% include ("foo.html", "bar.html") %}s+{% include ["foo.html", "bar.html", foo] %}s+{% include ("foo.html", "bar.html", foo) %}(RR3RR8(RR5R9((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_find_included_templates}s(R0R1R7R:R;(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyR2bs		tStreamingTestCasecBs,eZd�Zd�Zd�Zd�ZRS(cCs�tjd�}|jdttd���}|jt|�d�|jt|�d�|jt|�d�|jt|�d�|jt|�d�|jt|�d	�dS(
NsQ<ul>{% for item in seq %}<li>{{ loop.index }} - {{ item }}</li>{%- endfor %}</ul>tseqis<ul>s<li>1 - 0</li>s<li>2 - 1</li>s<li>3 - 2</li>s<li>4 - 3</li>s</ul>(RRtstreamtlisttrangetassert_equalR(RRR>((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_basic_streaming�scCsmtjd�}|jdttd���}|jdd�|jt|�d�|jt|�d�dS(NsQ<ul>{% for item in seq %}<li>{{ loop.index }} - {{ item }}</li>{%- endfor %}</ul>R=itsizeiu <ul><li>1 - 0</li><li>2 - 1</li>u!<li>3 - 2</li><li>4 - 3</li></ul>(RRR>R?R@tenable_bufferingRAR(RRR>((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_buffered_streaming�s
cCs6tjd�}|j�}|jd�|j�dS(Nti(RRR>RDtdisable_buffering(RRR>((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_streaming_behavior�s


cCs�tj�}z{tjd�}|j�}|jtjj|d�d�t	tjj|d�d��}|j
|j�d�WdQXWdtj
|�XdS(Nu✓sdump.txtsutf-8trbs✓(ttempfiletmkdtempRRR>tdumptostpathtjointopentassertEqualtreadtshutiltrmtree(RttmpRR>tf((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_dump_stream�s! (R0R1RBRERHRW(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyR<�s				tUndefinedTestCasecBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs>d�}td�}td�}|jt|jd|�dS(NcSs
t��dS(N(t
StopIteration(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest�ssA{{ test() }}BsA{{ test().missingattribute }}BRZ(R	t
assert_raisesRtrender(RRZR&((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_stopiteration_is_undefined�s	cCs)ytd�jWntk
r$nXdS(NtFoo(Rt__dict__tAttributeError(R((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyt%test_undefined_and_special_attributes�s

cCs�tdt�}|j|jd�j�d�|jt|jd�j�|j|jd�j�d�|j|jd�j�d�|j|jd	�jd
d�d�|j|jd
�j�d�dS(Nt	undefineds
{{ missing }}us{{ missing.attribute }}s{{ missing|list }}s[]s{{ missing is not defined }}tTrues{{ foo.missing }}Ri*RFs{{ not missing }}(RRRARR\R[R(RR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_default_undefined�s	%cCs�tdt�}|j|jd�j�d�|jt|jd�j�|j|jd�j�d�|j|jd�j�d�|j|jd�jd	d
�d�|j|jd�j�d�dS(
NRbs
{{ missing }}s{{ missing.attribute }}s{{ missing|list }}s[]s{{ missing is not defined }}Rcs{{ foo.missing }}Ri*u,{{ no such element: int object['missing'] }}s{{ not missing }}(RRRARR\R[R(RR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_debug_undefined�s	cCs�tdt�}|jt|jd�j�|jt|jd�j�|jt|jd�j�|j|jd�j�d�|jt|jd�jdd	�|jt|jd
�j�|j|jd�j�d�dS(
NRbs
{{ missing }}s{{ missing.attribute }}s{{ missing|list }}s{{ missing is not defined }}Rcs{{ foo.missing }}Ri*s{{ not missing }}s&{{ missing|default("default", true) }}tdefault(RRR[RRR\RA(RR((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_strict_undefined�s"cCs)td�}|jt|jdd�dS(Ns{{ var[42].foo }}tvari(R	R[RR\(RR&((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_indexing_gives_undefined�scCs4yt�jdd��Wntk
r/}nXdS(Ntsplit(RtgetattrRR(Rte((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_none_gives_proper_error�s
cCs4ytdddd��Wntk
r/}nXdS(Ntobji*R*tupper(RR(RRl((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyttest_object_repr�s
(
R0R1R]RaRdReRgRiRmRp(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyRX�s			
		
		cCshtj�}|jtjt��|jtjt��|jtjt��|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteRR2R<RX(tsuite((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyRu�s(t__doc__RqRMRJRStjinja2.testsuiteRtjinja2._compatRtjinja2RRRRRRRR	R
tjinja2.utilsRRRR2R<RXRu(((s8/usr/lib/python2.7/site-packages/jinja2/testsuite/api.pyt<module>
s@	G-*F

Zerion Mini Shell 1.0