Anonymous datatype validation
Project description
For full package documenation, please see: http://datatype.readthedocs.org/
Examples
>>> from datatype.validation import failures
>>> datatype = {'foo': [{'bar': 'int'}]}
>>> bad_value = {'foo': [{'bar': 'baz'}], 'bif': 'pow!'}
>>> failures(datatype, bad_value)
['unexpected property "bif"', 'foo[0].bar: expected int, got str']
Wildcard dictionary keys:
>>> datatype = {'_any_': ['int']}
>>> good_value = {'foo': [1, 2, 3], 'bar': [3, 4, 5]}
>>> failures(datatype, good_value)
[]
Coercion:
>>> from datatype.coercion import coerce_value >>> coerce_value(['str'], [1, 2, 3]) ['1', '2', '3']
Copyright and License
Copyright 2011-2012 LearningStation, Inc. and Adam Wagner
Licensed under the BSD-3 License. You may obtain a copy of the License in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
datatype-0.8.4.tar.gz
(4.5 kB
view details)
File details
Details for the file datatype-0.8.4.tar.gz.
File metadata
- Download URL: datatype-0.8.4.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0838247093cf2f4776bda3c00f7fafe6238b38181b982f76477e1d691c73c77f
|
|
| MD5 |
2ff1cc20133d9b0e92f6e5e02daacfd8
|
|
| BLAKE2b-256 |
813d53fd0963313fb90027765a50f3470325eedac09df3b01c7473890978ee13
|