• File: test_customization.cpython-38.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python38/lib/python3.8/site-packages/cerberus/tests/__pycache__/test_customization.cpython-38.pyc
  • Date Modified: 05/30/2024 3:23 PM
  • File size: 4.56 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
U

`7
@stddlmZddlZddlmZmZddlmZddZddZ	e
d	d
ddZe
d	d
d
dZddZ
dS))markN)assert_failassert_success)
sample_schemacsTGfdddtjdjks$tddddididd}tdd	gi|d
dS)Ncs&eZdZfddZddZZS)z=test_contextual_data_preservation.<locals>.InheritedValidatorcs(d|kr|d|_t|j||dS)Nworking_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.<locals>.InheritedValidator.__init__cSs|jr
dSdS)NTrr	valuerrr_validate_type_testszQtest_contextual_data_preservation.<locals>.InheritedValidator._validate_type_test)__name__
__module____qualname__rr
__classcell__rr)r
rrsrZtestlisttype)rschemaz/tmprfoo)	validator)cerberus	ValidatortypesAssertionErrorr)vrrr!test_contextual_data_preservation
s
r#cCs2Gdddtj}d|jks td|jks.tdS)Nc@seZdZddZddZdS)z/test_docstring_parsing.<locals>.CustomValidatorcSsdS)z{'type': 'zap'}Nr)r	Zargumentfieldrrrr
_validate_foosz=test_docstring_parsing.<locals>.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.<locals>.CustomValidator._validate_barN)rrrr%r&rrrrCustomValidatorsr'rZbar)rrZvalidation_rulesr!)r'rrrtest_docstring_parsingsr(rule)Z
check_withrcCsXGdddtj}|d|diid}tddi|dtddi|dd	tjjdd
fddS)Nc@seZdZddZdS)z+test_check_with_method.<locals>.MyValidatorcSs|d@s||ddSNMust be an odd numberZ_errorr	r$rrrr_check_with_oddity4sz>test_check_with_method.<locals>.MyValidator._check_with_oddityN)rrrr/rrrrMyValidator3sr0amountoddityrr+documentrrr,r5rerrorrrrrerrorsZCUSTOMr)r0r"rrrtest_check_with_method0sr=cCsXGdddtj}|d|diid}tddi|dtddi|dd	tjjdd
fddS)Nc@seZdZddZdS)z*test_validator_method.<locals>.MyValidatorcSs|d@s||ddSr*r-r.rrr_validator_oddityEsz<test_validator_method.<locals>.MyValidator._validator_oddityN)rrrr>rrrrr0Dsr0r1r2r3r+r4r6rr7r8r:r<rrrtest_validator_methodBsr?cCsHGdddtj}|td}|jddids0t|jddidrDtdS)Nc@s"eZdZdZejjjddZdS)zWtest_schema_validation_can_be_disabled_in_schema_setter.<locals>.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.<locals>.NonvalidatingValidator.schemaN)rrr__doc__rrrsetterrrrrNonvalidatingValidatorSsrCr3Z
an_integerr+)r5a)rrrZvalidater!)rCr"rrr7test_schema_validation_can_be_disabled_in_schema_setterRs
rE)ZpytestrrZcerberus.testsrrZcerberus.tests.conftestrr#r(Zparametrizer=r?rErrrr<module>s