MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/cerberus/tests/__pycache__/__init__.cpython-35.pyc


L�X��@s�ddlZddlmZmZmZmZddlmZiddddd�Zdd�Z	dd	�Z
ddd
ddddd�Zddd
d
d�Zfdd�Z
dd�Zdd�Zdd�Zdddd�ZdS)�N)�errors�	Validator�SchemaError�
DocumentError)�
sample_schemac
Cs}|dkrtt�}|dkrMtj|��}|||�WdQRXn,tj|d|��}|||�WdQRXdS)z{ Tests whether a specific exception is raised. Optionally also tests
        whether the exception message is as expected. N�message)rr�pytestZraises)�	exception�document�schema�	validator�msgZexcinfo�r�/__init__.py�assert_exception	srcGstt|�dS)zS Tests whether a validation raises an exception due to a malformed
        schema. N)rr)�argsrrr�assert_schema_errorsrcGstt|�dS)zU Tests whether a validation raises an exception due to a malformed
        document. N)rr)rrrr�assert_document_errorsrFc	Csf|dkrtt�}||||�}t|t�s?t�|sLt�|j}|dk	oj|dk	stt�|dk	o�|dk	s�t�|dk	o�|dks�t�|dk	r+t|�dks�t�t||�|dk	rbt|dj�t|�kst�t	|dj|�n7|dk	rbt|�t|�ksUt�t	||�|S)z# Tests whether a validation fails. N�r)
rr�
isinstance�bool�AssertionError�_errors�len�assert_has_error�child_errors�assert_has_errors)	r
rr�update�errorrr�resultZ
actual_errorsrrr�assert_fail#s&
	
%
r cCsX|dkrtt�}||||�}t|t�s?t�|sTt|j��dS)z& Tests whether a validation succeeds. N)rrrrrr)r
rrrrrrr�assert_success@sr!cCs{t|t�s|f}t|t�s0|f}t|tj�sHt�x,t|�D]�\}}t|tj�syt�y�|j|ks�t�|j|ks�t�|j	|j	ks�t�|j
|j
ks�t�|j|ks�t�|js	|j
|ks	t�Wn&tk
rYqUtk
r2�YqUXPqUWtdjd|d|dt|j	�d|d|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$�irrrrrJs2			

	rcCsLt|t�st�x0|D](}t|t�s7t�t||�qWdS)N)r�listrr&r)rZ_exp_errorsrrrrrrs
rcOscyt|||�Wn<tk
r(Yn7tk
rR}z|�WYdd}~Xn
Xtd��dS)NzAn unexpected error occurred.)rrr()rr�kwargs�errr�assert_not_has_errorys
r/cCs/t||id||dftj|f�dS)Nr�type)r rZBAD_TYPE)ZfieldZ	data_type�valuerrr�assert_bad_type�sr2cCsA|dkrtt�}t|||�|j|ks=t�dS)N)rrr!r
r)r
Zexpectedrrrrr�assert_normalized�sr3)rZcerberusrrrrZcerberus.tests.conftestrrrrr r!rrr/r2r3rrrr�<module>s"	
	
(