%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__/imports.cpython-37.pyc

B

~KR��@s�dZddlZddlmZddlmZmZddlmZm	Z	eee
dddd	��d
�Zdejd<Gd
d�de�Z
Gdd�de�Zdd�ZdS)z�
    jinja2.testsuite.imports
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Tests the import features (with includes).

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
�N)�
JinjaTestCase)�Environment�
DictLoader)�TemplateNotFound�TemplatesNotFoundz5{% macro test() %}[{{ foo }}|{{ bar }}]{% endmacro %}z[{{ foo }}|{{ 23 }}]z	({{ o }}))�module�headerZ	o_printer)�loader�Zbarc@s$eZdZdd�Zdd�Zdd�ZdS)�ImportsTestCasecCs�t�d�}|jdd�dkst�t�d�}|jdd�dks<t�t�d�}|jdd�dksZt�t�d�}|jdd�dksxt�t�d	�}|jdd�dks�t�t�d
�}|jdd�dks�t�dS)Nz({% import "module" as m %}{{ m.test() }}�*)�fooz[|23]z8{% import "module" as m without context %}{{ m.test() }}z5{% import "module" as m with context %}{{ m.test() }}z[42|23]z+{% from "module" import test %}{{ test() }}z;{% from "module" import test without context %}{{ test() }}z8{% from "module" import test with context %}{{ test() }})�test_env�from_string�render�AssertionError)�self�t�r�I/opt/alt/python37/lib/python3.7/site-packages/jinja2/testsuite/imports.py�test_context_importss





z$ImportsTestCase.test_context_importscCs6t�d�t�d�t�d�t�d�t�d�dS)Nz-{% from "foo" import bar, baz with context %}z.{% from "foo" import bar, baz, with context %}z){% from "foo" import bar, with context %}z*{% from "foo" import bar, with, context %}z.{% from "foo" import bar, with with context %})rr)rrrr�test_trailing_comma+s




z#ImportsTestCase.test_trailing_commacCsJt�d�j}|��dkst�t|d�r*t�|jdks8t�t|d�rFt�dS)Na
            {% macro toplevel() %}...{% endmacro %}
            {% macro __private() %}...{% endmacro %}
            {% set variable = 42 %}
            {% for item in [1] %}
                {% macro notthere() %}{% endmacro %}
            {% endfor %}
        z...Z	__missingrZnotthere)rrrZtoplevelr�hasattrZvariable)r�mrrr�test_exports2szImportsTestCase.test_exportsN)�__name__�
__module__�__qualname__rrrrrrrrsrc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�IncludesTestCasecCs^t�d�}|jdd�dkst�t�d�}|jdd�dks<t�t�d�}|jdd�dksZt�dS)Nz{% include "header" %}r)r
z[42|23]z#{% include "header" with context %}z&{% include "header" without context %}z[|23])rrrr)rrrrr�test_context_includeCs


z%IncludesTestCase.test_context_includec
Cs@t�d�}|jdd�dkst�t�d�}|jdd�dks<t�t�d�}|�t|j�y|��WnBtk
r�}z$|jdd	gks�t�|jd	ks�t�Wdd}~XYnXd
s�td��dd
�}t�d�}||�t�d�}||ddgd�t�d�}||dd�t�d�}||dd�t�d�}||dd�t�d�}||dd�dS)Nz#{% include ["missing", "header"] %}r)r
z[42|23]z4{% include ["missing", "missing2"] ignore missing %}�z%{% include ["missing", "missing2"] %}ZmissingZmissing2Fzthou shalt raisec[sd|d<|�|�dkst�dS)Nrr
z[42|23])rr)rZctxrrr�
test_includes\sz<IncludesTestCase.test_choice_includes.<locals>.test_includesz{% include x %}r)�xz{% include [x, "header"] %}z{% include [x] %})	rrrr�
assert_raisesrrZ	templates�name)rr�er!rrr�test_choice_includesKs2


 





z%IncludesTestCase.test_choice_includescCsLt�d�}|�t|j�x.dD]&}t�d|d�}|��dkst�qWdS)Nz{% include "missing" %})r zwith contextzwithout contextz${% include "missing" ignore missing z %}r )rrr#rrr)rrZextrarrr�test_include_ignoring_missingms

z.IncludesTestCase.test_include_ignoring_missingcCs0tttddd��d�}|�d���dks,t�dS)Nz;{% for item in [1, 2, 3] %}{% include 'item' %}{% endfor %}z
{{ item }})�main�item)r	r(Z123)rr�dictZget_templaterr)r�envrrr�#test_context_include_with_overridesusz4IncludesTestCase.test_context_include_with_overridescCs"t�d�}|����dkst�dS)Nz�
            {% macro outer(o) %}
            {% macro inner() %}
            {% include "o_printer" %}
            {% endmacro %}
            {{ inner() }}
            {% endmacro %}
            {{ outer("FOO") }}
        z(FOO))rrr�stripr)rrrrr�test_unoptimized_scopes|sz(IncludesTestCase.test_unoptimized_scopesN)rrrrr&r'r,r.rrrrrAs
"rcCs,t��}|�t�t��|�t�t��|S)N)�unittestZ	TestSuiteZaddTestZ	makeSuiterr)�suiterrrr0�sr0)�__doc__r/Zjinja2.testsuiterZjinja2rrZjinja2.exceptionsrrr*r�globalsrrr0rrrr�<module>
s
&H

Zerion Mini Shell 1.0