HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/jsonschema/tests/__pycache__/test_format.cpython-39.pyc
a

�,�ht�@sddZddlmZddlmZmZddlmZddlm	Z	e
d�Zed�Z
dd	�ZGd
d�de�ZdS)
zH
Tests for the parts of jsonschema related to the :kw:`format` keyword.
�)�TestCase)�
FormatChecker�ValidationError)�FormatError)�Draft4ValidatorzBoom!zBang!cCs|dkrt�t�dS)N�bang)�BANG�BOOM��thing�r�M/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/jsonschema/tests/test_format.py�boomsrc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestFormatCheckercCstdd�}|�|j�dS)Nr��formats)rZassertFalse�checkers��self�checkerrrr
�test_it_can_validate_no_formatss
z1TestFormatChecker.test_it_can_validate_no_formatscCs:|�t��tdgd�Wd�n1s,0YdS)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_formatscCspttj�}|�tjjd�|�t��t�d�t�Wd�n1sH0Y|�	tjt|tdfd��dS�Nrr)r)
�dictrrZ
addCleanup�popZassertWarns�DeprecationWarningZ
cls_checksr�assertEqual)r�originalr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_checkerscCs�t�}|jdtt�d�t�|�t��}|jddd�Wd�n1sJ0Y|�|j	j
t�|�|j	jt�|�t
|j	�d�|�tt���|jddd�Wd�n1s�0YdS)Nr�Zraises���instance�formatz12 is not a 'boom'r)rr!�typer	rrr�check�assertIs�	exception�cause�	__cause__r�strr)rr�cmrrr
�!test_it_catches_registered_errors0s,z3TestFormatChecker.test_it_catches_registered_errorscCs�t�}|jdtd�t�tddi|d�}|�t��}|�d�Wd�n1sR0Y|�|j	j
t�|�|j	jt�dS)Nrr#r')Zformat_checkerr	)
rr!�
ValueErrorrrrr�validater*r+r,r	r-)rr�	validatorr/rrr
�7test_format_error_causes_become_validation_error_causes?s(zITestFormatChecker.test_format_error_causes_become_validation_error_causescCsBt�}|�t��|jddd�Wd�n1s40YdS)Nznot-an-ipv4Zipv4r%)rrrr)rrrr
�'test_format_checkers_come_with_defaultsJs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>U�z-TestFormatChecker.test_repr.<locals>.<lambda>�barcSsdSr6rr
rrr
r7Vr8ZbazcSsdSr6rr
rrr
r7Wr8z.<FormatChecker checkers=['bar', 'baz', 'foo']>)rr!r�reprrrrr
�	test_reprSs
�zTestFormatChecker.test_reprN)�__name__�
__module__�__qualname__rrr r"r0r4r5r;rrrr
rs
	rN)�__doc__�unittestrZ
jsonschemarrZjsonschema.exceptionsrZjsonschema.validatorsrr1r	�ZeroDivisionErrorrrrrrrr
�<module>s