
Tests allow you to return true/false values depending on the tested value.


<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

If you use Visual Studio Code as your editor, you can use code snippets to speed up working with inserts.  
You can find the snippets in our Github repository: [https://github.com/Synerise/jinja-code-snippet](https://github.com/Synerise/jinja-code-snippet)

</div></div></div>


## IsContainingAll

Returns `true` if a list contains all the values from another list.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| list | yes | If this list contains all the items from the list provided in the params, the test returns `true`. |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| list | yes | The list that must be contained in the list provided as input |

**Example:**

<pre><code class="language-jinja">{{ [1, 2, 3] is containingall [2, 3] }}</code></pre>


## IsContaining

Returns `true` if a list contains the provided value.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| list | yes | If this list contains the value provided in the parameters, the test returns `true`. |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The value to search for in the input list |

**Example:**


<pre><code class="language-jinja">{{ [1, 2, 3] is containing 2 }}</code></pre>


## IsDefined

Returns `true` if the variable is defined.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The variable to check |

**Example:**  

<pre><code class="language-jinja">{%- if foo is defined -%}
    {# code to render if foo is defined #}
{%- else -%}
    {# code to render if foo is not defined #}
{%- endif -%}</code></pre>


## IsDivisibleBy

Returns `true` if a variable is divisible by a number.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The variable to check against the divisor |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The divisor |

**Example:**


<pre><code class="language-jinja">{%- if foo is divisibleby 5 -%}
    {# code to render if foo can be divided by 5 #}
{%- else -%}
    {# code to render if foo cannot be divided by 5 #}
{%- endif -%}</code></pre>


## IsEqualTo

Returns `true` if an object has the same value as another object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | First object for comparison |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | Second object for comparison |

**Example:**


<pre><code class="language-jinja">{%- if foo is equalto 42 -%}
    the foo attribute evaluates to the constant 42
{%- endif -%}</code></pre>


Usage with the selectattr filter:


<pre><code class="language-jinja">{{ users|selectattr("email", "equalto", "foo@bar.invalid") }}</code></pre>


## IsEven

Returns `true` if a value is an even number.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is even -%}
    {# code to render if foo is an even number #}
{%- else -%}
    {# code to render if foo is an odd number #}
{%- endif -%}</code></pre>


## IsIterable

Returns `true` if the object is iterable (for example, a sequence).

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is iterable -%}
    {# code to render if foo is iterable #}
{%- endif -%}</code></pre>


## IsLower

Returns `true` if a string is all lowercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is lower -%}
    {# code to render if the value of foo is all lowercase #}
{%- endif -%}</code></pre>


## IsMapping

Returns `true` if an object is a dictionary.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is mapping -%}
    {# code to render if foo is a dictionary #}
{%- endif -%}</code></pre>


## IsNumber

Returns `true` if the object is a number.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is number -%}
    {{ foo * 1000000 }}
{%- else -%}
    foo is not a number.
{%- endif -%}</code></pre>


## IsOdd

Returns `true` if a number is an odd number.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is odd -%}
    {# code to render if foo is an odd number #}
{%- else -%}
    {# code to render if foo is an even number #}
{%- endif -%}</code></pre>


## IsSameAs

Returns `true` if a variable points at same object as another variable.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The first variable to compare |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The second variable to compare |

**Example:**


<pre><code class="language-jinja">{%- if var_one is sameas var_two -%}
    {# code to render if the variables have identical values #}
{%- endif -%}</code></pre>


## IsSequence

Returns `true` if the variable is a sequence. Sequences are variables that are iterable.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is sequence -%}
    {# code to render foo is a sequence #}
{%- endif -%}</code></pre>


## IsStringContaining

Returns `true` if an object is a string which contains a specified other string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string that needs to contain the string provided as the parameter |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string that needs to be included in the string provided as input |

**Example:**

<pre><code class="language-jinja">{%- if foo is string_containing 'bar' -%}
    {# code to render if foo contains 'bar'  #}
{%- endif -%}</code></pre>


## IsString

Returns `true` if an object is a string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is string -%}
    {# code to render if foo is a string #}
{%- endif -%}</code></pre>


## IsStringStartingWith

Returns `true` if an object is a string which starts with a specified other string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string that needs to start with the string provided as the parameter |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to check against |

**Example:**


<pre><code class="language-jinja">{%- if foo is string_startingwith 'bar' -%}
    {# code to render if foo starts with 'bar' #}
{%- endif -%}</code></pre>


## IsTruthy

Returns `true` if a value is *truthy*. `IsTruthy` follows the same implicit conversion rules as `{% if %}` conditions. For `==` and `!=`, type conversion applies only when the other operand is a boolean.

| Input type | Returns `true` | Returns `false` |
| :--- | :--- | :--- |
| Boolean | `true` | `false` |
| Number | Any non-zero number | `0` |
| String | Any non-empty string, except `"false"` | `""` (empty string) or `"false"` |
| null | Never | Always |
| Collection (list, map) | Non-empty | Empty |
| Any other type | Always | Never |


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

The [`|bool` filter](/developers/inserts/filter#bool) uses stricter conversion rules and can return a different result from `is truthy` for the same input. For example, `'string' is truthy` returns `true`, but `'string'|bool` returns `false`.

</div></div></div>


**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is truthy -%}
    {# code to render if foo is truthy #}
{%- endif -%}</code></pre>



<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

For strict type-and-value equality without any boolean conversion, use the [`sameas` test](/developers/inserts/exptest#issameas). Unlike `is truthy`, `sameas` checks that two values are identical without type coercion. For example, `"1" == true` returns `true` due to boolean conversion, but `"1" is sameas true` returns `false` because the types differ.

</div></div></div>


## IsUndefined

Returns `true` if an object is undefined.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The object to check |


**Example:**


<pre><code class="language-jinja">{%- if foo is undefined -%}
    {# code to render if foo is undefined #}
{%- endif -%}</code></pre>


## IsUpper

Returns `true` if a string is all uppercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to check |

**Example:**


<pre><code class="language-jinja">{%- if foo is upper -%}
    {#  code to render if foo is a string and is all uppercase  #}
{%- endif -%}</code></pre>


## IsWithin

Returns `true` if a value is contained in a list.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The value to search for in the list |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| list | yes | The list to search in |

**Example:**


<pre><code class="language-jinja">{{ 2 is within [1, 2, 3] }}</code></pre>

