# Tests

> Reference for OneFuse Jinja2 tests used to evaluate variables and expressions

---

Site [llms.txt](/llms.txt)

---

Tests can be used to test a variable against a common [expression](/docs/onefuse/templating/expressions/).

To test a variable or expression, you add the [is-operator](/docs/onefuse/templating/expressions/#is) or [is not-operator](/docs/onefuse/templating/expressions/#not) plus the name of the test after the variable.

```jinja2
{{ 21 is divisibleby(3) }}

=> true
```

## boolean

Test returns `true` if the object is a boolean value.

```jinja2
{{ true is boolean }}

=> true
```

See also: [false](#false), [true](#true).

## defined

Test returns `true` if the variable is defined.

```jinja2
{{ foo is defined }}
```

Refer to the [default filter](/docs/onefuse/templating/filters/#default).

See also: [undefined](#undefined).

## divisibleby

Test returns `true` if the variable is divisible by a number.

```jinja2
{# divisibleby(num) #}

{{ 21 is divisibleby 3 }}

=> true
```

Refer to the [divide operator](/docs/onefuse/templating/expressions/#divide).

## eq

Test returns `true` if the variable equals the second variable.

```jinja2
{{ 1 is eq 2 }}

=> false
```

Refer to the [equality comparison](/docs/onefuse/templating/expressions/#equality).

See also: [ge](#ge), [gt](#gt), [le](#le), [lt](#lt), [ne](#ne).

## escaped

Test returns `true` if the variable is escaped.

```jinja2
{{ foo is escaped }}
```

Refer to the [escape filter](/docs/onefuse/templating/filters/#escape).

## even

Test returns `true` if the variable is even.

```jinja2
{{ 2 is even }}

=> true
```

See also: [float](#float), [integer](#integer), [number](#number), [odd](#odd).

## false

Test returns `true` if the variable is false.

```jinja2
{{ true is false }}

=> false
```

See also: [boolean](#boolean), [true](#true).

## float

Test returns `true` if the object is a float.

```jinja2
{{ foo is not float }}
```

Refer to the [float filter](/docs/onefuse/templating/filters/#float).

See also: [even](#even), [integer](#integer), [number](#number), [odd](#odd).

## ge

Test returns `true` if the variable is greater than or equal to the second variable.

```jinja2
{{ 3 is ge(3) }}

=> true
```

Refer to the [greater than or equal to comparison](/docs/onefuse/templating/expressions/#greater-than-or-equal-to).

See also: [eq](#eq), [gt](#gt), [le](#le), [lt](#lt), [ne](#ne).

## gt

Test returns `true` if the variable is greater than the second variable.

```jinja2
{{ 1 is gt(3) }}

=> false
```

Refer to the [greater than comparison](/docs/onefuse/templating/expressions/#greater-than).

See also: [eq](#eq), [ge](#ge), [le](#le), [lt](#lt), [ne](#ne).

## in

Test returns `true` if the variable is in the sequence.

```jinja2
{{ 1 is in [1, 2, 3] }}

=> true
```

Refer to the [`in` operator](/docs/onefuse/templating/expressions/#in).

## integer

Test returns `true` if the variable is an integer.

```jinja2
{{ "1" is integer }}

=> false
```

Refer to the [int filter](/docs/onefuse/templating/filters/#int).

See also: [even](#even), [float](#float), [number](#number), [odd](#odd).

## iterable

Test returns `true` if it is possible to iterate over an object.

```jinja2
{{ [1, 2, 3] is iterable }}

=> true
```

See also: [sequence](#sequence).

## le

Test returns `true` if the variable is less than or equal to the second variable.

```jinja2
{{ 3 is le(3) }}

=> true
```

Refer to the [less than or equal to comparison](/docs/onefuse/templating/expressions/#less-than-or-equal-to).

See also: [eq](#eq), [ge](#ge), [gt](#gt), [lt](#lt), [ne](#ne).

## lower

Test returns `true` if the variable is lowercased.

```jinja2
{{ "hello" is lower }}

=> true
```

Refer to the [lower filter](/docs/onefuse/templating/filters/#lower).

See also: [upper](#upper).

## lt

Test returns `true` if the variable is less than the second variable.

```jinja2
{{ 1 is lt(3) }}

=> true
```

Refer to the [less than comparison](/docs/onefuse/templating/expressions/#less-than).

See also: [eq](#eq), [ge](#ge), [gt](#gt), [le](#le), [ne](#ne).

## mapping

Test returns `true` if the object is a mapping.

```jinja2
{{ dict is mapping }}
```

Refer to the [dict literal](/docs/onefuse/templating/expressions/#dict).

## ne

Test returns `true` if the variable is not equal to the second variable.

```jinja2
{{ foo is ne bar }}
```

Refer to the [inequality comparison](/docs/onefuse/templating/expressions/#inequality).

See also: [eq](#eq), [ge](#ge), [gt](#gt), [le](#le), [lt](#lt).

## none

Test returns `true` if the variable is none.

```jinja2
{{ foo is none }}
```

Refer to the [default filter](/docs/onefuse/templating/filters/#default).

## number

Test returns `true` if the variable is a number.

```jinja2
{{ 1 is number }}

=> true
```

See also: [even](#even), [float](#float), [integer](#integer), [odd](#odd).

## odd

Test returns `true` if the variable is odd.

```jinja2
{{ 1 is odd }}

=> true
```

See also: [even](#even), [float](#float), [integer](#integer), [number](#number).

## sameas

Test returns `true` if an object points to the same memory address as another object.

```jinja2
{{ foo.bar is sameas 1 }}
```

## sequence

Test returns `true` if the variable is a sequence.

```jinja2
{{ [1,2,3] is sequence }}

=> true
```

Refer to the [sequence literal](/docs/onefuse/templating/expressions/#list).

See also: [iterable](#iterable).

## string

Test returns `true` if the variable is a string.

```jinja2
{{ "hello" is string }}

=> true
```

Refer to the [string filter](/docs/onefuse/templating/filters/#string).

## true

Test returns `true` if the object is true.

```jinja2
{{ true is true }}

=> true
```

See also: [boolean](#boolean), [false](#false).

## undefined

Test returns `true` if the variable is undefined.

```jinja2
{{ foo is undefined }}
```

Refer to the [default filter](/docs/onefuse/templating/filters/#default).

See also: [defined](#defined).

## upper

Test returns `true` if the variable is uppercased.

```jinja2
{{ "HELLO" is upper }}

=> true
```

Refer to the [upper filter](/docs/onefuse/templating/filters/#upper).

See also: [lower](#lower).
