3
\f[                !   @   sF  d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlZejdZeeZeZdd Zd	d
 Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Z d%d& Z!eeeeeeeeeeeeeeee e!ej"ej"ej"ej#ej#ej$ej$ej$ej%ej%ej&ej&ej&ej'ej'd' Z(dS )(z
    jinja2.tests
    ~~~~~~~~~~~~

    Jinja test functions. Used with the "is" operator.

    :copyright: (c) 2017 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
    N)Mapping)	Undefined)	text_typestring_typesinteger_typesz^-?\d+(\.\d+)?$c             C   s   | d dkS )z#Return true if the variable is odd.       )valuer	   r	   >C:\prj\env\wsgidav_build_3.6\lib\site-packages\jinja2\tests.pytest_odd   s    r   c             C   s   | d dkS )z$Return true if the variable is even.r   r   r	   )r
   r	   r	   r   	test_even   s    r   c             C   s   | | dkS )z-Check if a variable is divisible by a number.r   r	   )r
   numr	   r	   r   test_divisibleby#   s    r   c             C   s   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   )r
   r	   r	   r   test_defined(   s    r   c             C   s
   t | tS )z-Like :func:`defined` but the other way round.)r   r   )r
   r	   r	   r   test_undefined9   s    r   c             C   s   | dkS )z$Return true if the variable is none.Nr	   )r
   r	   r	   r   	test_none>   s    r   c             C   s   t | j S )z*Return true if the variable is lowercased.)r   islower)r
   r	   r	   r   
test_lowerC   s    r   c             C   s   t | j S )z*Return true if the variable is uppercased.)r   isupper)r
   r	   r	   r   
test_upperH   s    r   c             C   s
   t | tS )z&Return true if the object is a string.)r   r   )r
   r	   r	   r   test_stringM   s    r   c             C   s
   t | tS )zSReturn true if the object is a mapping (dict etc.).

    .. versionadded:: 2.6
    )r   r   )r
   r	   r	   r   test_mappingR   s    r   c             C   s   t | ttttjf S )z(Return true if the variable is a number.)r   r   floatcomplexdecimalDecimal)r
   r	   r	   r   test_numberZ   s    r   c          	   C   s"   yt |  | j W n
   dS dS )z^Return true if the variable is a sequence. Sequences are variables
    that are iterable.
    FT)len__getitem__)r
   r	   r	   r   test_sequence_   s    
r!   c             C   s   | |kS )zCheck 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	   )r
   otherr	   r	   r   test_sameask   s    
r#   c             C   s&   yt |  W n tk
r    dS X dS )z1Check if it's possible to iterate over an object.FT)iter	TypeError)r
   r	   r	   r   test_iterablex   s
    r&   c             C   s
   t | dS )zCheck if the value is escaped.__html__)hasattr)r
   r	   r	   r   test_escaped   s    r)   c             C   s   | |kS )z:Check if value is in seq.

    .. versionadded:: 2.10
    r	   )r
   seqr	   r	   r   test_in   s    r+   ) ZoddZevenZdivisiblebyZdefined	undefinednonelowerupperstringmappingnumbersequenceiterablecallableZsameasescapedinz==eqZequaltoz!=ne>gtZgreaterthangez>=<ltZlessthanz<=le))__doc__operatorrecollectionsr   jinja2.runtimer   jinja2._compatr   r   r   r   compile	number_retype
regex_typer5   test_callabler   r   r   r   r   r   r   r   r   r   r   r!   r#   r&   r)   r+   r8   r9   r;   r<   r>   r?   TESTSr	   r	   r	   r   <module>
   sr   
		