mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 02:41:25 -07:00
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:
parent
245ce9461d
commit
ed7623ecde
8 changed files with 210 additions and 114 deletions
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue