[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.137.183.57: ~ $
U

���`O�@s�ddlZddlZddlmZmZmZmZddlmZidddfdd�Z	dd�Z
dd	�Zddd�Zdd
d�Z
ddd�Zdd�Zdd�Zdd�Zddd�ZdS)�N)�errors�	Validator�SchemaError�
DocumentError)�
sample_schemac	Csf|dkrt�}|dkr8t�|��|||�W5QRXn*tj|t�|�d��|||�W5QRXdS)z
    Tests whether a specific exception is raised. Optionally also tests whether the
    exception message is as expected.
    N)�match)r�pytestZraises�re�escape)Z	exception�document�schema�	validator�msg�r�H/opt/alt/python38/lib/python3.8/site-packages/cerberus/tests/__init__.py�assert_exceptionsrcGsttf|��dS)zITests whether a validation raises an exception due to a malformed schema.N)rr��argsrrr�assert_schema_errorsrcGsttf|��dS)zKTests whether a validation raises an exception due to a malformed document.N)rrrrrr�assert_document_errorsrFc	Cs�|dkrtt�}||||�}t|t�s*t�|r2t�|j}|dk	rL|dk	rLt�|dk	rd|dk	rdtd��|dk	rx|dkrxt�|dk	r�t|�dks�t�t|f|��|dk	r�t|dj�t|�ks�t�t	|dj|�n&|dk	r�t|�t|�ks�t�t	||�|S)z!Tests whether a validation fails.NzGchild_errors can only be tested in conjunction with the error parameter�r)
rr�
isinstance�bool�AssertionError�_errors�len�assert_has_error�child_errors�assert_has_errors)	rrr
�update�errorrr�resultZ
actual_errorsrrr�assert_fail$s*
�
r"cCs<|dkrtt�}||||�}t|t�s*t�|s8t|j��dS)z$Tests whether a validation succeeds.N)rrrrrr)rrr
rr!rrr�assert_successJsr#rc	Cst|t�s|f}t|t�s |f}t|tj�s0t�t|�D]�\}}t|tj�sPt�zb|j|ks`t�|j|ksnt�|j	|j	ks~t�|j
|j
ks�t�|j|ks�t�|js�|j
|ks�t�Wn(tk
r�Yq8tk
r��Yq8X�qq8tdj||t|j	�|||d���|S)Nz�
        Error with properties:
          document_path={doc_path}
          schema_path={schema_path}
          code={code}
          constraint={constraint}
          info={info}
        not found in errors:
        {errors}
        )Zdoc_path�schema_path�code�info�
constraintr)r�tuplerZ	ErrorListr�	enumerateZValidationErrorZ
document_pathr$r%Zruler'Zis_group_errorr&�	Exception�format�hex)rZd_pathZs_pathZ	error_defr'r&�ir rrrrTs>


��rcCs8t|t�st�|D] }t|t�s$t�t|f|��qdS�N)r�listrr(r)rZ_exp_errorsr rrrr�src
OsZzt|f|�|�Wn8tk
r(Yn.tk
rL}z|�W5d}~XYn
Xtd��dS)NzAn unexpected error occurred.)rrr*)rr�kwargs�errr�assert_not_has_error�sr2cCs"t||i||dftj|fd�dS)N�type)r )r"rZBAD_TYPE)ZfieldZ	data_type�valuerrr�assert_bad_type�s�r5cCs.|dkrtt�}t|||�|j|ks*t�dSr.)rrr#rr)rZexpectedrr
rrr�assert_normalized�sr6)NNFNNN)NNF)r)NN)r	rZcerberusrrrrZcerberus.tests.conftestrrrrr"r#rrr2r5r6rrrr�<module>s&�
&


/

Filemanager

Name Type Size Permission Actions
__init__.cpython-38.opt-1.pyc File 3.33 KB 0644
__init__.cpython-38.pyc File 3.9 KB 0644
conftest.cpython-38.opt-1.pyc File 1.93 KB 0644
conftest.cpython-38.pyc File 1.93 KB 0644
test_assorted.cpython-38.opt-1.pyc File 3.75 KB 0644
test_assorted.cpython-38.pyc File 4.01 KB 0644
test_customization.cpython-38.opt-1.pyc File 4.37 KB 0644
test_customization.cpython-38.pyc File 4.56 KB 0644
test_errors.cpython-38.opt-1.pyc File 5.53 KB 0644
test_errors.cpython-38.pyc File 8.28 KB 0644
test_legacy.cpython-38.opt-1.pyc File 168 B 0644
test_legacy.cpython-38.pyc File 168 B 0644
test_normalization.cpython-38.opt-1.pyc File 14.6 KB 0644
test_normalization.cpython-38.pyc File 15.16 KB 0644
test_registries.cpython-38.opt-1.pyc File 2.98 KB 0644
test_registries.cpython-38.pyc File 3.05 KB 0644
test_schema.cpython-38.opt-1.pyc File 4.76 KB 0644
test_schema.cpython-38.pyc File 5.46 KB 0644
test_utils.cpython-38.opt-1.pyc File 437 B 0644
test_utils.cpython-38.pyc File 485 B 0644
test_validation.cpython-38.opt-1.pyc File 40.9 KB 0644
test_validation.cpython-38.pyc File 42.88 KB 0644