J2 test docs (#16646)

* moved tests from filters to actual jinja2 tests

also removed some unused declarations and imports

* split tests into their own docs

removed isnan as existing jinja2's 'number' already covers same
added missing docs for several tests

* updated as per feedback
This commit is contained in:
Brian Coca 2016-07-12 10:13:00 -04:00 committed by GitHub
parent 245ce9461d
commit ed7623ecde
8 changed files with 210 additions and 114 deletions

View file

@ -18,12 +18,20 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import math
def issubset(a, b):
return set(a) <= set(b)
def issuperset(a, b):
return set(a) >= set(b)
def isnotanumber(x):
try:
return math.isnan(x)
except TypeError:
return False
class TestModule:
''' Ansible math jinja2 tests '''
@ -32,4 +40,5 @@ class TestModule:
# set theory
'issubset': issubset,
'issuperset': issuperset,
'isnan': isnotanumber,
}