Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Functions | Variables
jinja2.tests Namespace Reference

Functions

bool test_odd (int value)
 
bool test_even (int value)
 
bool test_divisibleby (int value, int num)
 
bool test_defined (t.Any value)
 
bool test_undefined (t.Any value)
 
bool test_filter ("Environment" env, str value)
 
bool test_test ("Environment" env, str value)
 
bool test_none (t.Any value)
 
bool test_boolean (t.Any value)
 
bool test_false (t.Any value)
 
bool test_true (t.Any value)
 
bool test_integer (t.Any value)
 
bool test_float (t.Any value)
 
bool test_lower (str value)
 
bool test_upper (str value)
 
bool test_string (t.Any value)
 
bool test_mapping (t.Any value)
 
bool test_number (t.Any value)
 
bool test_sequence (t.Any value)
 
bool test_sameas (t.Any value, t.Any other)
 
bool test_iterable (t.Any value)
 
bool test_escaped (t.Any value)
 
bool test_in (t.Any value, t.Container[t.Any] seq)
 

Variables

dict TESTS
 

Detailed Description

Built-in template tests used with the ``is`` operator.

Function Documentation

◆ test_boolean()

bool jinja2.tests.test_boolean ( t.Any  value)
Return true if the object is a boolean value.

.. versionadded:: 2.11

◆ test_defined()

bool jinja2.tests.test_defined ( t.Any  value)
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.

◆ test_divisibleby()

bool jinja2.tests.test_divisibleby ( int  value,
int  num 
)
Check if a variable is divisible by a number.

◆ test_escaped()

bool jinja2.tests.test_escaped ( t.Any  value)
Check if the value is escaped.

◆ test_even()

bool jinja2.tests.test_even ( int  value)
Return true if the variable is even.

◆ test_false()

bool jinja2.tests.test_false ( t.Any  value)
Return true if the object is False.

.. versionadded:: 2.11

◆ test_filter()

bool jinja2.tests.test_filter ( "Environment"  env,
str  value 
)
Check 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

◆ test_float()

bool jinja2.tests.test_float ( t.Any  value)
Return true if the object is a float.

.. versionadded:: 2.11

◆ test_in()

bool jinja2.tests.test_in ( t.Any  value,
t.Container[t.Any]  seq 
)
Check if value is in seq.

.. versionadded:: 2.10

◆ test_integer()

bool jinja2.tests.test_integer ( t.Any  value)
Return true if the object is an integer.

.. versionadded:: 2.11

◆ test_iterable()

bool jinja2.tests.test_iterable ( t.Any  value)
Check if it's possible to iterate over an object.

◆ test_lower()

bool jinja2.tests.test_lower ( str  value)
Return true if the variable is lowercased.

◆ test_mapping()

bool jinja2.tests.test_mapping ( t.Any  value)
Return true if the object is a mapping (dict etc.).

.. versionadded:: 2.6

◆ test_none()

bool jinja2.tests.test_none ( t.Any  value)
Return true if the variable is none.

◆ test_number()

bool jinja2.tests.test_number ( t.Any  value)
Return true if the variable is a number.

◆ test_odd()

bool jinja2.tests.test_odd ( int  value)
Return true if the variable is odd.

◆ test_sameas()

bool jinja2.tests.test_sameas ( t.Any  value,
t.Any  other 
)
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 %}

◆ test_sequence()

bool jinja2.tests.test_sequence ( t.Any  value)
Return true if the variable is a sequence. Sequences are variables
that are iterable.

◆ test_string()

bool jinja2.tests.test_string ( t.Any  value)
Return true if the object is a string.

◆ test_test()

bool jinja2.tests.test_test ( "Environment"  env,
str  value 
)
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

◆ test_true()

bool jinja2.tests.test_true ( t.Any  value)
Return true if the object is True.

.. versionadded:: 2.11

◆ test_undefined()

bool jinja2.tests.test_undefined ( t.Any  value)
Like :func:`defined` but the other way round.

◆ test_upper()

bool jinja2.tests.test_upper ( str  value)
Return true if the variable is uppercased.