March 2019
Intermediate to advanced
412 pages
9h 49m
English
A test in Jinja2 is used to see if a variable matches certain well-defined criteria, and we have come across this already in this chapter in certain specific scenarios. The is operator is used to initiate a test. Tests are used any place a Boolean result is desired, such as with if expressions and task conditionals. There are many built-in tests, but we'll highlight a few of the particularly useful ones, as follows:
To test whether a value is not something, simply use is not.
Read now
Unlock full access