Other standard datatypes have their own checkers.
BoolCheck checks against a number of boolean-equivalent expressions.
The optional attribute on top of the standard attributes:
If True, accepts None or “None” and treates as False.
BoolCheck accepts the following values and normalizes them as True
- True, “TRUE”, “True”, “true”, “T”, “t”, “YES”, “Yes”, “yes”, “Y”, “y”, “1”
BoolCheck accepts the following values and normalizes them as False
- False, “FALSE”, “False”, “false”, “F”, “f”, “NO”, “No”, “no”, “N”, “n”, “0”
IntCheck(name[, min, max])
IntCheck checks attributes and elements containing integer data.
Parameters: |
|
---|
The max and min attributes are inclusive, they default to NINF and INF, respectively.
Calling an IntCheck instance supports the as_string keyword.
The following example shows the many ways IntCheck accepts data:
from xcheck import IntCheck, ET
value = IntCheck('value', min=2, max=12)
text = '<value>5</value>'
node = ET.fromstring(text)
print value(9)
print value('9')
print value('9.0')
print value(text)
print value(node)
All of the above lines will print True.
DecimalCheck(name[, min, max])
DicimalCheck checks attributes and elements containing float data.
Parameters: |
|
---|
The max and min attributes are inclusive, they default to NINF and INF, respectively.
DateTimeCheck(name[, keywords]) Checks date and time formatted strings, date objects, and time objects.
Parameters: |
|
---|
Additional attributes in __call__
Parameters: |
|
---|