Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no test named 'None' #520

Closed
jakirkham opened this issue Dec 13, 2015 · 2 comments
Closed

no test named 'None' #520

jakirkham opened this issue Dec 13, 2015 · 2 comments

Comments

@jakirkham
Copy link

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.

@ThiefMaster
Copy link
Member

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.

@jakirkham
Copy link
Author

Thanks @ThiefMaster. I'm still pretty new to jinja, but it seems pretty cool. Thanks for the pointers too.

bibliotechy pushed a commit to tulibraries/ansible-role-airflow that referenced this issue Jun 10, 2020
ansible when evaluates the statement as jinja, and jinja "is" is not the
same as Python "is". In the words of President CLinton, it depends when the definition of "is" is.

More info in pallets/jinja#520
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants