Running into an issue where using a template like this {{"" if np is None else np}}, I get the following exception jinja2.exceptions.TemplateAssertionError: no test named 'None'. Trying with is not has similar problems.
Use lowercase none.
Jinja's is is different from Python's is. It invokes functions registered as "tests". And while there's a none test, there's no test named None.
Useful side-note: Jinja also uses lowercase for true and false, even though the python-cased True and False work too.
Thanks @ThiefMaster. I'm still pretty new to jinja, but it seems pretty cool. Thanks for the pointers too.
Most helpful comment
Use lowercase
none.Jinja's
isis different from Python'sis. It invokes functions registered as "tests". And while there's anonetest, there's no test namedNone.Useful side-note: Jinja also uses lowercase for
trueandfalse, even though the python-casedTrueandFalsework too.