7s3r d Z ddlmZ ddlmZmZmZ ddlmZ e d Z
ed Zd Z
G d d e Zd
S )zP
Tests for the parts of jsonschema related to the :validator:`format` property.
)TestCase)FormatErrorValidationError
FormatChecker)Draft4ValidatorzBoom!zBang!c * | dk rt t )Nbang)BANGBOOMthings |/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/jsonschema/tests/test_format.pyboomr s
J c > e Zd Zd Zd Zd Zd Zd Zd Zd Z d Z
d S )
TestFormatCheckerc Z t d }| |j d S )N formats)r assertFalsecheckersselfcheckers r test_it_can_validate_no_formatsz1TestFormatChecker.test_it_can_validate_no_formats s/ +++)*****r c | t 5 t dg d d d d S # 1 swxY w Y d S )Nzo noesr )assertRaisesKeyErrorr )r s r .test_it_raises_a_key_error_for_unknown_formatsz@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formats s
x
(
( . .8*---- . . . . . . . . . . . . . . . . . .s
:>>c 2 t t j }| t j j d t j d t | t j t |t df d S Nr r )r )dictr r
addCleanuppop
cls_checksr assertEqual)r originals r !test_it_can_register_cls_checkersz3TestFormatChecker.test_it_can_register_cls_checkers s
.//
.2F;;;(
((..."r
+++
r c t } | d t | |j t t j t df d S r" )r checksr r' r r# r s r test_it_can_register_checkersz/TestFormatChecker.test_it_can_register_checkers' sf //vt$$$'tRj999
r c d t } | dt t t | t 5 }| dd d d d n# 1 swxY w Y | |j j
t | |j j t | t t 5 | dd d d d d S # 1 swxY w Y d S )Nr raises instanceformatr )
r r+ typer r r r checkassertIs exceptioncause __cause__r
)r r cms r !test_it_catches_registered_errorsz3TestFormatChecker.test_it_catches_registered_errors/ sw //1vd4jj11$777
{
+
+ 6rMM2fM555 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
bl($///
bl,d333
tDzz
*
* : :MM6&M999 : : : : : : : : : : : : : : : : : :s$ BBB D%%D),D)c t } | dt t t ddi| }| t 5 }| d d d d n# 1 swxY w Y | |j j
t | |j j t d S )Nr r. r3 )format_checkerr )
r r+
ValueErrorr r r r validater6 r7 r8 r r9 )r r validatorr: s r 7test_format_error_causes_become_validation_error_causeszITestFormatChecker.test_format_error_causes_become_validation_error_causes= s //1vj11$777#Xv$6wOOO
/
/ '2v&&& ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
bl($///
bl,d33333s &BBBc t }| t 5 | dd d d d d S # 1 swxY w Y d S )Nznot-an-ipv4ipv4r1 )r r r r5 r s r 'test_format_checkers_come_with_defaultsz9TestFormatChecker.test_format_checkers_come_with_defaultsH s
//
{
+
+ A AMM=M@@@ A A A A A A A A A A A A A A A A A As AAAc & t d } | d d | d d | d d | t | d d S )
Nr r fooc dS NTr r s r