U `7 @stddlmZddlZddlmZmZddlmZddZddZ e d d d d Z e d d d dZ ddZ dS))markN) assert_failassert_success) sample_schemacsFGfdddtjddddididd}tdd gi|d dS) Ncs&eZdZfddZddZZS)z=test_contextual_data_preservation..InheritedValidatorcs(d|kr|d|_t|j||dS)N working_dir)rsuper__init__)selfargskwargs)InheritedValidator __class__R/opt/alt/python38/lib/python3.8/site-packages/cerberus/tests/test_customization.pyr s zFtest_contextual_data_preservation..InheritedValidator.__init__cSs|jr dSdS)NTrr valuerrr_validate_type_testszQtest_contextual_data_preservation..InheritedValidator._validate_type_test)__name__ __module__ __qualname__rr __classcell__rr )r rr sr Ztestlisttype)rschemaz/tmprZfoo) validator)cerberus Validatorr)vrrr!test_contextual_data_preservation s  r cCsGdddtj}dS)Nc@seZdZddZddZdS)z/test_docstring_parsing..CustomValidatorcSsdS)z{'type': 'zap'}Nr)r Zargumentfieldrrrr _validate_foosz=test_docstring_parsing..CustomValidator._validate_foocSsdS)z Test the barreness of a value. The rule's arguments are validated against this schema: {'type': 'boolean'} Nrrrrr _validate_bar"sz=test_docstring_parsing..CustomValidator._validate_barN)rrrr"r#rrrrCustomValidatorsr$)rr)r$rrrtest_docstring_parsingsr%rule)Z check_withrcCsXGdddtj}|d|diid}tddi|dtddi|dd tjjdd fd dS) Nc@seZdZddZdS)z+test_check_with_method..MyValidatorcSs|d@s||ddSNMust be an odd numberZ_errorr r!rrrr_check_with_oddity4sz>test_check_with_method..MyValidator._check_with_oddityN)rrrr,rrrr MyValidator3sr-amountoddityrr(documentrrr)r2rerrorrrrrerrorsZCUSTOMr&r-rrrrtest_check_with_method0sr:cCsXGdddtj}|d|diid}tddi|dtddi|dd tjjdd fd dS) Nc@seZdZddZdS)z*test_validator_method..MyValidatorcSs|d@s||ddSr'r*r+rrr_validator_oddityEsz.MyValidator._validator_oddityN)rrrr;rrrrr-Dsr-r.r/r0r(r1r3rr4r5r7r9rrrtest_validator_methodBsr<cCs Gdddtj}|td}dS)Nc@s"eZdZdZejjjddZdS)zWtest_schema_validation_can_be_disabled_in_schema_setter..NonvalidatingValidatorzD Skips schema validation to speed up initialization cSsF|dkrd|_n2|jr||_n$t|tjjr4||_ntj||_dS)N)Z_schemaZis_child isinstancerrZDefinitionSchemaZUnvalidatedSchema)r rrrrrXsz^test_schema_validation_can_be_disabled_in_schema_setter..NonvalidatingValidator.schemaN)rrr__doc__rrrsetterrrrrNonvalidatingValidatorSsr@r0)rrr)r@rrrr7test_schema_validation_can_be_disabled_in_schema_setterRs rA)ZpytestrrZcerberus.testsrrZcerberus.tests.conftestrr r%Z parametrizer:r<rArrrrs