Skip to content
Myr

Added a note on why equalto exists.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 7d3e4e4 · Browse files · 1 file+10 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−0 removed

  • other:+10 added−0 removed

1 file+10 added−0 removed

modified:jinja2/tests.py+10 added
100 unmodified lines
101 except:102 return False103 return True104105106def test_equalto(value, other):107 """Check if an object has the same value as another object:108109 .. sourcecode:: jinja110111 {% if foo.expression is equalto 42 %}112 the foo attribute evaluates to the constant 42113 {% endif %}114115 This appears to be a useless test as it does exactly the same as the116 ``==`` operator, but it can be useful when used together with the117 `selectattr` function:118119 .. sourcecode:: jinja120121 {{ users|selectattr("email", "equalto", "foo@bar.invalid") }}122 """123 return value == other124125126def test_sameas(value, other):127 """Check if an object points to the same memory address than another128 object:129
42 unmodified lines