HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/jsonschema/tests/__pycache__/test_format.cpython-38.pyc
U

>��]��@s\dZddlmZddlmZmZmZddlmZe	d�Z
ed�Zdd�Z
Gd	d
�d
e�ZdS)zP
Tests for the parts of jsonschema related to the :validator:`format` property.
�)�TestCase)�FormatError�ValidationError�
FormatChecker)�Draft4ValidatorzBoom!zBang!cCs|dkrt�t�dS)N�bang)�BANG�BOOM��thing�r�>/usr/lib/python3/dist-packages/jsonschema/tests/test_format.py�boomsrc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestFormatCheckercCstdd�}|�|j�dS)Nr�Zformats)rZassertFalse�checkers��self�checkerrrr
�test_it_can_validate_no_formatss
z1TestFormatChecker.test_it_can_validate_no_formatsc	Cs&|�t��tdgd�W5QRXdS)Nzo noesr)�assertRaises�KeyErrorr)rrrr
�.test_it_raises_a_key_error_for_unknown_formatssz@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formatscCsFttj�}|�tjjd�t�d�t�|�tjt|tdfd��dS�Nrr)r)�dictrrZ
addCleanup�popZ
cls_checksr�assertEqual)rZoriginalrrr
�!test_it_can_register_cls_checkerss
�z3TestFormatChecker.test_it_can_register_cls_checkerscCs4t�}|�d�t�|�|jttjtdfd��dSr)r�checksrrrrrrrr
�test_it_can_register_checkers's�z/TestFormatChecker.test_it_can_register_checkersc	Cs�t�}|jdtt�d�t�|�t��}|jddd�W5QRX|�|j	j
t�|�|j	jt�|�tt���|jddd�W5QRXdS)Nr�Zraises���instance�formatr)
rr�typer	rrr�check�assertIs�	exception�cause�	__cause__r)rr�cmrrr
�!test_it_catches_registered_errors/sz3TestFormatChecker.test_it_catches_registered_errorsc	Cslt�}|jdtd�t�tddi|d�}|�t��}|�d�W5QRX|�|j	j
t�|�|j	jt�dS)Nrr r$)Zformat_checkerr	)
rr�
ValueErrorrrrrZvalidater'r(r)r	r*)rrZ	validatorr+rrr
�7test_format_error_causes_become_validation_error_causes=szITestFormatChecker.test_format_error_causes_become_validation_error_causesc	Cs.t�}|�t��|jddd�W5QRXdS)Nznot-an-ipv4Zipv4r")rrrr&rrrr
�'test_format_checkers_come_with_defaultsHsz9TestFormatChecker.test_format_checkers_come_with_defaultscCsTtdd�}|�d�dd��|�d�dd��|�d�d	d��|�t|�d
�dS)NrrZfoocSsdS�NTrr
rrr
�<lambda>S�z-TestFormatChecker.test_repr.<locals>.<lambda>ZbarcSsdSr0rr
rrr
r1Tr2ZbazcSsdSr0rr
rrr
r1Ur2z.<FormatChecker checkers=['bar', 'baz', 'foo']>)rrr�reprrrrr
�	test_reprQs
�zTestFormatChecker.test_reprN)�__name__�
__module__�__qualname__rrrrr,r.r/r4rrrr
rs		rN)�__doc__ZunittestrZ
jsonschemarrrZjsonschema.validatorsrr-r	�ZeroDivisionErrorrrrrrrr
�<module>s