HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/jsonschema/tests/__pycache__/test_format.cpython-36.opt-1.pyc
3

�;Xd�@sJdZddlmZmZddlmZmZmZddlm	Z	Gdd�dej
�ZdS)zQ
Tests for the parts of jsonschema related to the :validator:`format` property.

�)�mock�unittest)�FormatError�ValidationError�
FormatChecker)�Draft4Validatorc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestFormatCheckercCstj�|_dS)N)rZMock�fn)�self�r�!/usr/lib/python3.6/test_format.py�setUp
szTestFormatChecker.setUpcCstfd�}|j|j�dS)N)�formats)rZassertFalse�checkers)r
�checkerrrr�test_it_can_validate_no_formatss
z1TestFormatChecker.test_it_can_validate_no_formatsc
Cs&|jt��tdgd�WdQRXdS)Nzo noes)r)�assertRaises�KeyErrorr)r
rrr�.test_it_raises_a_key_error_for_unknown_formatssz@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formatscCsJtjjtjdd��.tjd�|j�|jtjd|jffi�WdQRXdS)NT)�clear�new)rZpatch�dictrrZ
cls_checksr	�assertEqual)r
rrr�!test_it_can_register_cls_checkerssz3TestFormatChecker.test_it_can_register_cls_checkerscCs8t�}|jd�|j�|j|jttj|jffd��dS)Nr)r)r�checksr	rrr)r
rrrr�test_it_can_register_checkerss
z/TestFormatChecker.test_it_can_register_checkerscCs�t�}t�}|j_|jdtd�|j�|jt��}|jdd�WdQRX|j|j	j
|�|j|j	j|�t|j_|jt��|jdd�WdQRXdS)N�foo)�raises�bar)
r�
ValueErrorr	�side_effectrrrZcheck�assertIs�	exception�cause�	__cause__�AttributeError)r
rr#�cmrrr�!test_it_catches_registered_errors%sz3TestFormatChecker.test_it_catches_registered_errorsc
Cslt�}|jdtd�|j�t�}|j_tddi|d�}|jt��}|jd�WdQRX|j	|j
j|�dS)Nr)r�format)Zformat_checkerr)rrrr	r rrrZvalidater!r"r$)r
rr#Z	validatorr&rrr�7test_format_error_causes_become_validation_error_causes6szITestFormatChecker.test_format_error_causes_become_validation_error_causesN)
�__name__�
__module__�__qualname__r
rrrrr'r)rrrrrsrN)�__doc__Zjsonschema.tests.compatrrZ
jsonschemarrrZjsonschema.validatorsrZTestCaserrrrr�<module>s