Spade
Mini Shell
| Directory:~$ /proc/self/root/lib/python2.7/site-packages/jinja2/testsuite/ |
| [Home] [System Details] [Kill Me] |
�
,��Qc@s�dZddlZddlZddlZddlZddlZddlmZmZm Z m
Z
mZmZm
Z
ddlmZmZddlmZmZddlmZddlmZdefd ��YZd
efd��YZd�ZdS(
s�
jinja2.testsuite.loader
~~~~~~~~~~~~~~~~~~~~~~~
Test the loaders.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
i����N(t
JinjaTestCasetdict_loadertpackage_loadertfilesystem_loadertfunction_loadert
choice_loadert
prefix_loader(tEnvironmenttloaders(tPYPYtPY2(tsplit_template_path(tTemplateNotFoundtLoaderTestCasecBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
RS( cCsVtdt�}|jd�}|j�j�dks<t�|jt|jd�dS(Ntloaders
justdict.htmltFOOsmissing.html(RRtget_templatetrendertstriptAssertionErrort
assert_raisesR(tselftenvttmpl((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_dict_loaderscCsVtdt�}|jd�}|j�j�dks<t�|jt|jd�dS(NRs test.htmltBARsmissing.html(RRRRRRRR(RRR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_package_loader#scCs�tdt�}|jd�}|j�j�dks<t�|jd�}|j�j�dksit�|jt|jd�dS(NRs test.htmlRs
foo/test.htmlRsmissing.html(RRRRRRRR(RRR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_filesystem_loader)scCs�tdt�}|jd�}|j�j�dks<t�|jd�}|j�j�dksit�|jt|jd�dS(NRs
justdict.htmlRs test.htmlRsmissing.html(RRRRRRRR(RRR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_choice_loader1scCsVtdt�}|jd�}|j�j�dks<t�|jt|jd�dS(NRsjustfunction.htmlRsmissing.html(RRRRRRRR(RRR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_function_loader9scCs�tdt�}|jd�}|j�j�dks<t�|jd�}|j�j�dksit�|jt|jd�dS(NRsa/test.htmlRsb/justdict.htmlRtmissing(RRRRRRRR(RRR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_prefix_loader?scs�t�dtjf�fd��Y}td|�dd�}|jd�}||jd�ksgt�t�||jd�k s�t�t�td|�dd�}|jd�|jd�k s�t�td|�dd�}|jd �}|jd
�}||jd
�kst�||jd �ks6t�|jd�}d |jksZt�d
|jksot�d|jks�t�dS(Nt
TestLoadercseZ�fd�ZRS(csdd�fd�fS(Nufoocs�S(N(((tchanged(s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyt<lambda>Ks(tNone(Rtenvironmentttemplate(R!(s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyt
get_sourceJs(t__name__t
__module__R&((R!(s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyR
IsRt
cache_sizei����R%iitonettwotthree(tFalseRt
BaseLoaderRRRtTruetcache(RR
RRtt1tt2tt3((R!s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_cachingGs(cCsuidd6}tdtj|��}|jd�j�dksFt�d|d<|jd�j�dksqt�dS(NR*tfooRR+(RRt
DictLoaderRRR(RtmappingR((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyt"test_dict_loader_cache_invalidatesas
!
cCsStd�ddgkst�td�ddgks<t�|jttd�dS(Nsfoo/barR5tbars ./foo/bars../foo(RRRR(R((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_split_template_pathhs(R'R(RRRRRRR4R8R:(((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyR
s tModuleLoaderTestCasecBs�eZdZded�Zd�Zd�Zd�Zd�Z d�Z
d�Zd�Ze
rsersd �Znd
�Zd�ZRS(
tdeflatedcCs�tt|�j�g}tdt�|_|dk rStjdd�d|_ ntj
�|_ |jj|j d|d|jd|�tdt
j|j ��|_dj|�S( NRtsuffixs.zipitziptlog_functiont
py_compilet(tsuperR;tsetupRRtreg_envR#ttempfiletmkstemptarchivetmkdtemptcompile_templatestappendRtModuleLoadertmod_envtjoin(RR>R@tlog((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pytcompile_downqs cCsjtt|�j�t|d�rftjj|j�rJtj|j�nt j
|j�d|_ndS(NRL(RBR;tteardownthasattrtostpathtisfileRGtremovetshutiltrmtreeR#(R((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyRPscCsF|j�}d|kst�d|ks0t�d|ksBt�dS(NsKCompiled
"a/foo/test.html" as
tmpl_a790caf9d669e39ea4d280d597ec891c4ef0404asFinished compiling
templatessGCould not compile "a/syntaxerror.html": Encountered
unknown tag
'endif'(ROR(RRN((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_log�scCs�|jjd�}|jjd�}|j�|j�ksBt�|jjd�}|jjd�}|j�|j�ks�t�dS(Nsa/test.htmlsb/justdict.html(RDRRLRR(Rttmpl1ttmpl2((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyt_test_common�scCs|jdd�|j�dS(NR>R<(ROR[(R((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_deflated_zip_compile�scCs|jdd�|j�dS(NR>tstored(ROR[(R((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_stored_zip_compile�scCs|jdd�|j�dS(NR>(ROR#R[(R((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_filesystem_compile�scCs�|j�|jjd�}tjjd�}|jjjj}t |jjj|�s^t
�|tjksst
�d|_}yddl}|j�WnnX|tjks�t
�dS(Nsa/test.htmli����(RORLRRRKtget_template_keyRtmoduleR'RQRtsystmodulesR#tgctcollect(RRtkeytnameRd((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_weak_references�s
cCsd|jdt�}d|ks$t�|jjd�}|jjjj}|jj d�s`t�dS(NR@sByte-compiled
"a/test.html"sa/test.htmls.pyc(
ROR/RRLRRRat-tmpl_3c4ddf650c1a73df961a6d3d2ce2752f1b8fd490t__file__tendswith(RRNRYtmod((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyttest_byte_compilation�s
cCs�|j�}tj|jjtjidd6�g�|j_|jjd�}|j|j�d�|jjd�}|j|j�d�dS(Nt
DICT_TEMPLATEtDICT_SOURCEsa/test.htmlR( RORtChoiceLoaderRLRR6Rtassert_equalR(RRNRYRZ((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyR�s "cCs�|j�}tji|jjd6tjidd6�d6�|j_|jjd�}|j|j�d�|jjd�}|j|j�d�dS(NtMODRns test.htmltDICTsMOD/a/test.htmlRsDICT/test.html( RORtPrefixLoaderRLRR6RRqR(RRNRYRZ((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyR�s
#N(R'R(R#RGR-RORPRXR[R\R^R_RhR
R RmRR(((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyR;ns
cCs<tj�}|jtjt��|jtjt��|S(N(tunittestt TestSuitetaddTestt makeSuiteR
R;(tsuite((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyRy�s(t__doc__RRRbRERVRutjinja2.testsuiteRRRRRRRtjinja2RRtjinja2._compatR R
tjinja2.loadersRtjinja2.exceptionsRR
R;Ry(((s;/usr/lib/python2.7/site-packages/jinja2/testsuite/loader.pyt<module>
s4Sp