HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python38/lib/python3.8/site-packages/cerberus/tests/__pycache__/__init__.cpython-38.pyc
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)�	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)	rr
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)rr
rr r"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�sr3cCs"t||i||dftj|fd�dS)N�type)r!)r#rZBAD_TYPE)�fieldZ	data_type�valuerrr�assert_bad_type�s�r7cCs.|dkrtt�}t|||�|j|ks*t�dSr/)rrr$rr)rZexpectedr
rrrr�assert_normalized�sr8)NNFNNN)NNF)r)NN)r	rZcerberusrrrrZcerberus.tests.conftestrrrrr#r$rrr3r7r8rrrr�<module>s&�
&


/