Used to validate objects cleanly and simply.
Very good for testing implementation. ;)
>>> import clean_validator
>>>
>>> if clean_validator.assert_valid_object({"name": "SleX"}, {"name": str}):
>>> print('OK')
>>>
>>> if clean_validator.assert_valid_object(
>>> [
>>> {"email": "[email protected]", "name": "SleX", "idade": 37},
>>> {"email": "[email protected]", "name": "Alexandre"},
>>> ],
>>> [{
>>> "email": lambda e: '@' in e and '.' in e,
>>> "name": str,
>>> "idade": (int, clean_validator.TypeNone,),
>>> }]
>>> ):
>>> print('OK')
>>>
Use pip
or easy_install
:
$ pip install clean-validator
Use py.test
Use pep8