3

U'ícã(@srdZddlZddlZddlmZddlmZddlm	Z	ddl
mZejrVddl
mZeed	œd
d„Zeed	œdd
„Zeeedœdd„Zejed	œdd„Zejed	œdd„Zedeedœdd„ƒZedeedœdd„ƒZejed	œdd„Zejed	œdd„Zejed	œdd „Zejed	œd!d"„Zejed	œd#d$„Zejed	œd%d&„Zeed	œd'd(„Z eed	œd)d*„Z!ejed	œd+d,„Z"ejed	œd-d.„Z#ejed	œd/d0„Z$ejed	œd1d2„Z%ejejed3œd4d5„Z&ejed	œd6d7„Z'ejed	œd8d9„Z(ejej)ed:œd;d<„Z*eeeeeeeeeeeeee e!e"e#e$e%e'e+e&e(e*ej,ej,ej,ej-ej-ej.ej.ej.ej/ej/ej0ej0ej0ej1ej1d=œ'Z2dS)>z6Built-in template tests used with the ``is`` operator.éN)Úabc)ÚNumberé)Ú	Undefined)Úpass_environment)ÚEnvironment)ÚvalueÚreturncCs|ddkS)z#Return true if the variable is odd.ér©)rrrú./tmp/pip-build-gk9425m9/Jinja2/jinja2/tests.pyÚtest_oddsr
cCs|ddkS)z$Return true if the variable is even.r
rr)rrrrÚ	test_evensr)rÚnumr	cCs||dkS)z-Check if a variable is divisible by a number.rr)rrrrrÚtest_divisiblebysrcCst|tƒS)a;Return true if the variable is defined:

    .. sourcecode:: jinja

        {% if variable is defined %}
            value of variable: {{ variable }}
        {% else %}
            variable is not defined
        {% endif %}

    See the :func:`default` filter for a simple way to set undefined
    variables.
    )Ú
isinstancer)rrrrÚtest_definedsrcCs
t|tƒS)z-Like :func:`defined` but the other way round.)rr)rrrrÚtest_undefined.srr)Úenvrr	cCs
||jkS)aCheck if a filter exists by name. Useful if a filter may be
    optionally available.

    .. code-block:: jinja

        {% if 'markdown' is filter %}
            {{ value | markdown }}
        {% else %}
            {{ value }}
        {% endif %}

    .. versionadded:: 3.0
    )Úfilters)rrrrrÚtest_filter3srcCs
||jkS)a‚Check if a test exists by name. Useful if a test may be
    optionally available.

    .. code-block:: jinja

        {% if 'loud' is test %}
            {% if value is loud %}
                {{ value|upper }}
            {% else %}
                {{ value|lower }}
            {% endif %}
        {% else %}
            {{ value }}
        {% endif %}

    .. versionadded:: 3.0
    )Útests)rrrrrÚ	test_testEsrcCs|dkS)z$Return true if the variable is none.Nr)rrrrÚ	test_none[srcCs|dkp|dkS)zNReturn true if the object is a boolean value.

    .. versionadded:: 2.11
    TFr)rrrrÚtest_boolean`srcCs|dkS)zDReturn true if the object is False.

    .. versionadded:: 2.11
    Fr)rrrrÚ
test_falsehsrcCs|dkS)zCReturn true if the object is True.

    .. versionadded:: 2.11
    Tr)rrrrÚ	test_truepsrcCst|tƒo|dk	o|dk	S)zIReturn true if the object is an integer.

    .. versionadded:: 2.11
    TF)rÚint)rrrrÚtest_integerysrcCs
t|tƒS)zFReturn true if the object is a float.

    .. versionadded:: 2.11
    )rÚfloat)rrrrÚ
test_float‚sr cCst|ƒjƒS)z*Return true if the variable is lowercased.)ÚstrÚislower)rrrrÚ
test_lowerŠsr#cCst|ƒjƒS)z*Return true if the variable is uppercased.)r!Úisupper)rrrrÚ
test_uppersr%cCs
t|tƒS)z&Return true if the object is a string.)rr!)rrrrÚtest_string”sr&cCst|tjƒS)zSReturn true if the object is a mapping (dict etc.).

    .. versionadded:: 2.6
    )rrÚMapping)rrrrÚtest_mapping™sr(cCs
t|tƒS)z(Return true if the variable is a number.)rr)rrrrÚtest_number¡sr)cCs,yt|ƒ|jWntk
r&dSXdS)z^Return true if the variable is a sequence. Sequences are variables
    that are iterable.
    FT)ÚlenÚ__getitem__Ú	Exception)rrrrÚ
test_sequence¦s
r-)rÚotherr	cCs||kS)zïCheck if an object points to the same memory address than another
    object:

    .. sourcecode:: jinja

        {% if foo.attribute is sameas false %}
            the foo attribute really is the `False` singleton
        {% endif %}
    r)rr.rrrÚtest_sameas³s
r/cCs&yt|ƒWntk
r dSXdS)z1Check if it's possible to iterate over an object.FT)ÚiterÚ	TypeError)rrrrÚ
test_iterableÀs
r2cCs
t|dƒS)zCheck if the value is escaped.Z__html__)Úhasattr)rrrrÚtest_escapedÊsr4)rÚseqr	cCs||kS)z:Check if value is in seq.

    .. versionadded:: 2.10
    r)rr5rrrÚtest_inÏsr6)'ZoddZevenZdivisiblebyZdefinedZ	undefinedÚfilterÚtestÚnoneÚbooleanÚfalseÚtrueÚintegerrÚlowerÚupperÚstringÚmappingÚnumberÚsequenceÚiterableÚcallableZsameasÚescapedÚinz==ÚeqZequaltoz!=Úneú>ÚgtZgreaterthanÚgez>=ú<ÚltZlessthanz<=Úle)3Ú__doc__ÚoperatorÚtypingÚtÚcollectionsrZnumbersrZruntimerÚutilsrZ
TYPE_CHECKINGÚenvironmentrrÚboolr
rrZAnyrrr!rrrrrrrr r#r%r&r(r)r-r/r2r4Ú	Containerr6rErHrIrKrLrNrOZTESTSrrrrÚ<module>s