]> git.ipfire.org Git - thirdparty/jinja.git/commit
Add test for greater/less than (#624)
authorMajor Hayden <major@mhtx.net>
Wed, 4 Jan 2017 16:21:53 +0000 (10:21 -0600)
committerDavid Lord <davidism@gmail.com>
Wed, 4 Jan 2017 16:21:53 +0000 (08:21 -0800)
commit65fbf324ab55b4e349065de82a73c733ccb8d9ac
treee128a9dd9c0035369e29e6ccc7f36c73cf10ea2d
parentebed13eb2b0995d015ddcaacca72fadc829b09e6
Add test for greater/less than (#624)

It can be helpful to have a test for values that are greater or less than
another value, especially when looping over lists and using `select()` or
`selectattr()` filters. This patch adds tests that allow a developer to
check if a value is greater or less than another value.

For example, if I have a list of vehicles and I want to find the motorcycles:

    vehicles | selectattr('wheels', 'lessthan', 3)

Or, if I want to find large trucks:

    vehicles | selectattr('wheels', 'greaterthan', 4)

Tests are included.
jinja2/tests.py
tests/test_tests.py