+
     ht  c                   sz    R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	 ]
! R4      t]! R4      tR t ! R R	]4      tR
# )zH
Tests for the parts of jsonschema related to the :kw:`format` keyword.
)TestCase)FormatCheckerValidationError)FormatError)Draft4ValidatorzBoom!zBang!c                 s(    V R 8X  d   \         h\        h)bang)BANGBOOMZthing   &A/usr/lib/python3.14/site-packages/jsonschema/tests/test_format.pyboomr      s    

J    c                   sP   a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	tV tR
# )TestFormatCheckerc                sT    \        RR 7      pV P                  VP                  4       R# )ZformatsN )r   ZassertFalsecheckersselfchecker   & r
   test_it_can_validate_no_formatsZ1TestFormatChecker.test_it_can_validate_no_formats   s     +))*r   c                s    V P                  \        4      ;_uu_ 4        \        R .R7       RRR4       R#   + '       g   i     R# ; i)zo noesr   N)assertRaisesZKeyErrorr   )r   r	   r
   .test_it_raises_a_key_error_for_unknown_formatsZ@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formats   s,    x((8*- )(((s	   6A	c                s   \        \        P                  4      pV P                  \        P                  P                  R 4       V P                  \        4      ;_uu_ 4        \        P                  ! R 4      ! \        4       RRR4       V P                  \        P                  \        V\        R3R7      4       R#   + '       g   i     LC; i)r   Nr   r   )
dictr   r   Z
addCleanupZpopZassertWarnsZDeprecationWarningZ
cls_checksr   assertEqual)r   Zoriginalr   r
   !test_it_can_register_cls_checkersZ3TestFormatChecker.test_it_can_register_cls_checkers   s    ../..22F;011$$V,T2 2""r
+	
 21s   !!B==C	c                s    \        4       pVP                  R 4      ! \        4       V P                  VP                  \        \         P                  \        R3R7      4       R# )r   r   Nr   )r   checksr   r   r   r   r   r   r
   test_it_can_register_checkersZ/TestFormatChecker.test_it_can_register_checkers(   sE    /vt$''tRj9	
r   c                s   \        4       pVP                  R \        \        4      R7      ! \        4       V P                  \        4      ;_uu_ 4       pVP                  ^R R7       RRR4       V P                  XP                  P                  \        4       V P                  VP                  P                  \        4       V P                  \        VP                  4      R4       V P                  \        \        4      4      ;_uu_ 4        VP                  RR R7       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r   ZraisesZinstanceformatNz12 is not a 'boom'r   )r   r   Ztyper   r   r   r   checkassertIs	exceptioncause	__cause__r   Zstrr   )r   r   cms   &  r
   !test_it_catches_registered_errorsZ3TestFormatChecker.test_it_catches_registered_errors0   s    /vd4j1$7{++rMM2fM5 , 	bll(($/bll,,d3R\\*,@A tDz**MM6&M9 +* ,+ +**s   D+D>+D;	>E	c                s   \        4       pVP                  R \        R7      ! \        4       \	        RR /VR7      pV P                  \        4      ;_uu_ 4       pVP                  R4       RRR4       V P                  XP                  P                  \        4       V P                  VP                  P                  \        4       R#   + '       g   i     Lf; i)r   r   r    )Zformat_checkerr   N)r   r   
ValueErrorr   r   r   r   Zvalidater"   r#   r$   r   r%   )r   r   Z	validatorr&   s   &   r
   7test_format_error_causes_become_validation_error_causesZITestFormatChecker.test_format_error_causes_become_validation_error_causes?   s    /vj1$7#Xv$6wO	//2v& 0 	bll(($/bll,,d3	 0/s   CC	c                s    \        4       pV P                  \        4      ;_uu_ 4        VP                  R RR7       RRR4       R#   + '       g   i     R# ; i)znot-an-ipv4Zipv4r   N)r   r   r   r!   r   r   r
   'test_format_checkers_come_with_defaultsZ9TestFormatChecker.test_format_checkers_come_with_defaultsJ   s;    
  /{++MM=M@ ,+++s   AA	c                s    \        R	R 7      pVP                  R4      ! R 4       VP                  R4      ! R 4       VP                  R4      ! R 4       V P                  \        V4      R4       R# )
r   Zfooc                     R # Tr   r   r	   r
   <lambda>-TestFormatChecker.test_repr.<locals>.<lambda>U       Dr   Zbarc                 r+   r,   r   r   r	   r
   r-   r.   V   r/   r   Zbazc                 r+   r,   r   r   r	   r
   r-   r.   W   r/   r   z.<FormatChecker checkers=['bar', 'baz', 'foo']>Nr   )r   r   r   Zreprr   r   r
   	test_reprZTestFormatChecker.test_reprS   sZ    +u01u01u01M<	
r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__r   r   r   r   r'   r)   r*   r0   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r
   r   r      s3     +.

:	4A
 
r   r   N)Z__doc__Zunittestr    Z
jsonschemar   r   Zjsonschema.exceptionsr   Zjsonschema.validatorsr   r(   r   ZZeroDivisionErrorr   r   r   r   r   r
   <module>r1      s?     5 - 1'!F
 F
r   