Viewing File: /opt/alt/python35/lib/python3.5/site-packages/cerberus/tests/__pycache__/test_schema.cpython-35.pyc



LX@sddlZddlmZmZmZddlmZddZddZdd	Z	d
dZ
dd
ZddZddZ
ddZddZddZddZdS)N)	ValidatorerrorsSchemaError)assert_schema_errorcCs=t}tjtdtj|iddWdQRXdS)Nmessageschema)rpytestraisesrrZSCHEMA_ERROR_MISSING)	validatorr/test_schema.pytest_empty_schema	s	r
c	CsBd}tjj|}tjtd|||_WdQRXdS)Nz!this string should really be dictr)rZSCHEMA_ERROR_DEFINITION_TYPEformatrr	rr)r
rZexp_msgrrrtest_bad_schema_typesrc	CsHd}|ddddiiii}tjt||_WdQRXdS)NfoorZbartypeZstrong)rr	rr)r
fieldrrrrtest_bad_schema_type_fieldsrc
Cs<d}tjtd|dddii|_WdQRXdS)Nz({'foo': [{'unknown': ['unknown rule']}]}rrunknownrule)rr	rr)r
rrrrtest_unknown_rulesrc
Csdd}d}t|dd|gigi}tjtd|dddii|_WdQRXdS)	NnameZcatch_merzunallowed value %srrrr)strrr	rr)r
rvaluerrrrtest_unknown_type#s
"rc	CsKd}t|dgi}tjtd||di|_WdQRXdS)Nrzmust be of dict typerzthis should really be a dict)rrr	rr)r
rrrrrtest_bad_schema_definition+srcCs)ddddiii}ti|dS)Nranyofrstring)r)rrrrbad_of_rules2srcCsddddddddiigigii}tddi|dddd	ddddiigigii}tddi|dS)
NdocrdictrrZparamnumberzthis is my documentZallof)r)rrrr test_anyof_allof_schema_validate7s	$	$r"cCs7tdddii}t|jdks3tdS)Nrrrz{'foo': {'type': 'string'}})rreprrAssertionError)vrrr	test_reprEsr&cCstddtii}t|j}tdddii}|d7}t|j|ksdttddtii}t|j|kstd}||kstd|dS)NZfoozifixZcoercerZinteger~aThere's an unexpected high amount (%s) of cached valid definition schemas. Unless you added further tests, there are good chances that something is wrong. If you added tests with new schemas, you can try to adjust the variable `max_cache_size` according to the added schemas.)rintlenZ_valid_schemasr$)r%Z
cache_sizeZmax_cache_sizerrrtest_validated_schema_cacheJs
r+cCscdddddgiii}t|}|jdddddiddigiks_tdS)NZdetroitrZanyof_regexz^AladdinzSane$rregex)rrr$)rr%rrrtest_expansion_in_nested_schema_sr-)rZcerberusrrrZcerberus.testsrr
rrrrrrr"r&r+r-rrrr<module>s
Back to Directory File Manager