%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/jinja2/testsuite/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/testsuite/__pycache__/loader.cpython-37.pyc

B

,��Q��@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZmZddlmZmZddlmZddlmZGdd	�d	e�ZGd
d�de�Zdd
�ZdS)z�
    jinja2.testsuite.loader
    ~~~~~~~~~~~~~~~~~~~~~~~

    Test the loaders.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
�N)�
JinjaTestCase�dict_loader�package_loader�filesystem_loader�function_loader�
choice_loader�
prefix_loader)�Environment�loaders)�PYPY�PY2)�split_template_path)�TemplateNotFoundc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�LoaderTestCasecCs<ttd�}|�d�}|����dks(t�|�t|jd�dS)N)�loaderz
justdict.html�FOOzmissing.html)r	r�get_template�render�strip�AssertionError�
assert_raisesr)�self�env�tmpl�r�H/opt/alt/python37/lib/python3.7/site-packages/jinja2/testsuite/loader.py�test_dict_loaders

zLoaderTestCase.test_dict_loadercCs<ttd�}|�d�}|����dks(t�|�t|jd�dS)N)rz	test.html�BARzmissing.html)r	rrrrrrr)rrrrrr�test_package_loader#s

z"LoaderTestCase.test_package_loadercCsZttd�}|�d�}|����dks(t�|�d�}|����dksFt�|�t|jd�dS)N)rz	test.htmlrz
foo/test.htmlrzmissing.html)r	rrrrrrr)rrrrrr�test_filesystem_loader)s


z%LoaderTestCase.test_filesystem_loadercCsZttd�}|�d�}|����dks(t�|�d�}|����dksFt�|�t|jd�dS)N)rz
justdict.htmlrz	test.htmlrzmissing.html)r	rrrrrrr)rrrrrr�test_choice_loader1s


z!LoaderTestCase.test_choice_loadercCs<ttd�}|�d�}|����dks(t�|�t|jd�dS)N)rzjustfunction.htmlrzmissing.html)r	rrrrrrr)rrrrrr�test_function_loader9s

z#LoaderTestCase.test_function_loadercCsZttd�}|�d�}|����dks(t�|�d�}|����dksFt�|�t|jd�dS)N)rza/test.htmlrzb/justdict.htmlrZmissing)r	rrrrrrr)rrrrrr�test_prefix_loader?s


z!LoaderTestCase.test_prefix_loadercsd�G�fdd�dtj�}t|�dd�}|�d�}||�d�ksDt�d�||�d�k	sZt�d�t|�dd�}|�d�|�d�k	s�t�t|�d	d�}|�d
�}|�d�}||�d�ks�t�||�d
�ks�t�|�d�}d
|jks�t�d|jks�t�d|jks�t�dS)
NFcseZdZ�fdd�ZdS)z/LoaderTestCase.test_caching.<locals>.TestLoadercsdd�fdd�fS)N�foocs�S)Nrr)�changedrr�<lambda>K�zLLoaderTestCase.test_caching.<locals>.TestLoader.get_source.<locals>.<lambda>r)rZenvironment�template)r$rr�
get_sourceJsz:LoaderTestCase.test_caching.<locals>.TestLoader.get_sourceN)�__name__�
__module__�__qualname__r(r)r$rr�
TestLoaderIsr,���)rZ
cache_sizer'Tr��one�twoZthree)r
Z
BaseLoaderr	rr�cache)rr,rrZt1Zt2Zt3r)r$r�test_cachingGs(



zLoaderTestCase.test_cachingcCsPddi}tt�|�d�}|�d���dks.t�d|d<|�d���dksLt�dS)Nr#r/)rr0)r	r
�
DictLoaderrrr)r�mappingrrrr�"test_dict_loader_cache_invalidatesas
z1LoaderTestCase.test_dict_loader_cache_invalidatescCs:td�ddgkst�td�ddgks(t�|�ttd�dS)Nzfoo/barr#Zbarz	./foo/barz../foo)r
rrr)rrrr�test_split_template_pathhsz'LoaderTestCase.test_split_template_pathN)r)r*r+rrrr r!r"r2r5r6rrrrrsrcs~eZdZdZd�fdd�	Z�fdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zerfe
sfdd�Zdd�Zdd�Z�ZS)�ModuleLoaderTestCaseN�deflatedFcsztt|���g}ttd�|_|dk	r:tjdd�d|_n
t�	�|_|jj
|j||j|d�tt�
|j�d�|_d�|�S)N)rz.zip)�suffix�)�zipZlog_function�
py_compile�)�superr7Zsetupr	r�reg_env�tempfileZmkstemp�archiveZmkdtempZcompile_templates�appendr
�ModuleLoader�mod_env�join)rr;r<�log)�	__class__rr�compile_downqs
z!ModuleLoaderTestCase.compile_downcsJtt|���t|d�rFtj�|j�r4t�|j�nt	�
|j�d|_dS)NrD)r>r7�teardown�hasattr�os�path�isfilerA�remove�shutilZrmtree)r)rGrrrIs
zModuleLoaderTestCase.teardowncCs0|��}d|kst�d|ks t�d|ks,t�dS)NzKCompiled "a/foo/test.html" as tmpl_a790caf9d669e39ea4d280d597ec891c4ef0404azFinished compiling templateszGCould not compile "a/syntaxerror.html": Encountered unknown tag 'endif')rHr)rrFrrr�test_log�s
zModuleLoaderTestCase.test_logcCs\|j�d�}|j�d�}|��|��ks,t�|j�d�}|j�d�}|��|��ksXt�dS)Nza/test.htmlzb/justdict.html)r?rrDrr)r�tmpl1�tmpl2rrr�_test_common�sz!ModuleLoaderTestCase._test_commoncCs|jdd�|��dS)Nr8)r;)rHrS)rrrr�test_deflated_zip_compile�sz.ModuleLoaderTestCase.test_deflated_zip_compilecCs|jdd�|��dS)NZstored)r;)rHrS)rrrr�test_stored_zip_compile�sz,ModuleLoaderTestCase.test_stored_zip_compilecCs|jdd�|��dS)N)r;)rHrS)rrrr�test_filesystem_compile�sz,ModuleLoaderTestCase.test_filesystem_compilecCs�|��|j�d�}tj�d�}|jjjj}t	|jjj|�s@t
�|tjksNt
�d|_}yddl
}|��WnYnX|tjks�t
�dS)Nza/test.htmlr)rHrDrr
rCZget_template_keyr�moduler)rJr�sys�modules�gcZcollect)rr�key�namerZrrr�test_weak_references�s
z)ModuleLoaderTestCase.test_weak_referencescCsD|jdd�}d|kst�|j�d�}|jjjj}|j�d�s@t�dS)NT)r<zByte-compiled "a/test.html"za/test.htmlz.pyc)	rHrrDrrrWZ-tmpl_3c4ddf650c1a73df961a6d3d2ce2752f1b8fd490�__file__�endswith)rrFrQ�modrrr�test_byte_compilation�s
z*ModuleLoaderTestCase.test_byte_compilationcCsd|��}t�|jjt�ddi�g�|j_|j�d�}|�|��d�|j�d�}|�|��d�dS)NZDICT_SOURCE�
DICT_TEMPLATEza/test.htmlr)	rHr
ZChoiceLoaderrDrr3r�assert_equalr)rrFrQrRrrrr �sz'ModuleLoaderTestCase.test_choice_loadercCsf|��}t�|jjt�ddi�d��|j_|j�d�}|�|��d�|j�d�}|�|��d�dS)Nz	test.htmlrb)ZMODZDICTzMOD/a/test.htmlrzDICT/test.html)	rHr
ZPrefixLoaderrDrr3rrcr)rrFrQrRrrrr"�sz'ModuleLoaderTestCase.test_prefix_loader)r8F)r)r*r+rArHrIrPrSrTrUrVr]rrrar r"�
__classcell__rr)rGrr7ns		
r7cCs,t��}|�t�t��|�t�t��|S)N)�unittestZ	TestSuiteZaddTestZ	makeSuiterr7)�suiterrrrf�srf)�__doc__rKrXr@rOreZjinja2.testsuiterrrrrrrZjinja2r	r
Zjinja2._compatrrZjinja2.loadersr
Zjinja2.exceptionsrrr7rfrrrr�<module>
s$Sp

Zerion Mini Shell 1.0