Ë
    ùmxit  ã                   óx   — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	  e
d«      Z ed«      Zd„ Z G d	„ d
e«      Zy)zH
Tests for the parts of jsonschema related to the :kw:`format` keyword.
é    )ÚTestCase)ÚFormatCheckerÚValidationError)ÚFormatError)ÚDraft4ValidatorzBoom!zBang!c                 ó$   — | dk(  rt         ‚t        ‚)NÚbang)ÚBANGÚBOOM©Úthings    úS/home/htdocs/ttos/venv/lib/python3.12/site-packages/jsonschema/tests/test_format.pyÚboomr      s   € Ø�‚Üˆ
Ü
€Jó    c                   ó<   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
ÚTestFormatCheckerc                 óR   — t        d¬«      }| j                  |j                  «       y )N© ©Úformats)r   ÚassertFalseÚcheckers©ÚselfÚcheckers     r   Útest_it_can_validate_no_formatsz1TestFormatChecker.test_it_can_validate_no_formats   s    € Ü¨Ô+ˆØ×Ñ˜×)Ñ)Õ*r   c                 ór   — | j                  t        «      5  t        dg¬«       d d d «       y # 1 sw Y   y xY w)Nzo noesr   )ÚassertRaisesÚKeyErrorr   )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   –-­6c                 ó~  — t        t        j                  «      }| j                  t        j                  j                  d«       | j                  t        «      5   t        j                  d«      t        «       d d d «       | j                  t        j                  t        |t        df¬«      «       y # 1 sw Y   Œ;xY w©Nr   r   )r   )
Údictr   r   Ú
addCleanupÚpopÚassertWarnsÚDeprecationWarningÚ
cls_checksr   ÚassertEqual)r   Úoriginals     r   Ú!test_it_can_register_cls_checkersz3TestFormatChecker.test_it_can_register_cls_checkers   sŠ   € Üœ×.Ñ.Ó/ˆØ�‰œ×.Ñ.×2Ñ2°FÔ;Ø×ÑÔ0Ó1ñ 	3Ø,ŒM×$Ñ$ VÓ,¬TÔ2÷	3à×ÑÜ×"Ñ"Ü�¤ r 
Ô+õ	
÷	3ð 	3ús   Á B3Â3B<c                 óÄ   — t        «       } |j                  d«      t        «       | j                  |j                  t        t         j                  t        df¬«      «       y r"   )r   Úchecksr   r)   r   r#   r   s     r   Útest_it_can_register_checkersz/TestFormatChecker.test_it_can_register_checkers(   sG   € Ü“/ˆØˆ�‰�vÓœtÔ$Ø×ÑØ×ÑÜ”×'Ñ'¬t°R¨jÔ9õ	
r   c                 ód  — t        «       } |j                  dt        t        «      ¬«      t        «       | j                  t        «      5 }|j                  dd¬«       d d d «       | j                  j                  j                  t        «       | j                  |j                  j                  t        «       | j                  t        |j                  «      d«       | j                  t        t        «      «      5  |j                  dd¬«       d d d «       y # 1 sw Y   Œ½xY w# 1 sw Y   y xY w)Nr   ©Úraisesé   ©ÚinstanceÚformatz12 is not a 'boom'r	   )r   r-   Útyper   r   r   r   ÚcheckÚassertIsÚ	exceptionÚcauseÚ	__cause__r)   Ústrr
   )r   r   Úcms      r   Ú!test_it_catches_registered_errorsz3TestFormatChecker.test_it_catches_registered_errors0   sã   € Ü“/ˆØ1ˆ�‰�v¤d¬4£jˆÓ1´$Ô7à×Ñœ{Ó+ð 	6¨rØ�M‰M 2¨fˆMÔ5÷	6ð 	�‰�b—l‘l×(Ñ(¬$Ô/Ø�‰�b—l‘l×,Ñ,¬dÔ3Ø×Ñœ˜RŸ\™\Ó*Ð,@ÔAð ×Ñœt¤D›zÓ*ñ 	:Ø�M‰M 6°&ˆMÔ9÷	:ð 	:÷	6ð 	6ú÷	:ð 	:ús   Á
DÃ=D&ÄD#Ä&D/c                 ó–  — t        «       } |j                  dt        ¬«      t        «       t	        ddi|¬«      }| j                  t        «      5 }|j                  d«       d d d «       | j                  j                  j                  t        «       | j                  |j                  j                  t        «       y # 1 sw Y   Œ^xY w)Nr   r0   r5   )Úformat_checkerr   )r   r-   Ú
ValueErrorr   r   r   r   Úvalidater8   r9   r:   r   r;   )r   r   Ú	validatorr=   s       r   Ú7test_format_error_causes_become_validation_error_causeszITestFormatChecker.test_format_error_causes_become_validation_error_causes?   s–   € Ü“/ˆØ1ˆ�‰�v¤jˆÓ1´$Ô7Ü# X¨vÐ$6ÀwÔOˆ	à×ÑœÓ/ð 	'°2Ø×Ñ˜vÔ&÷	'ð 	�‰�b—l‘l×(Ñ(¬$Ô/Ø�‰�b—l‘l×,Ñ,¬dÕ3÷		'ð 	'ús   ÁB?Â?Cc                 ó’   — t        «       }| j                  t        «      5  |j                  dd¬«       d d d «       y # 1 sw Y   y xY w)Nznot-an-ipv4Úipv4r3   )r   r   r   r7   r   s     r   Ú'test_format_checkers_come_with_defaultsz9TestFormatChecker.test_format_checkers_come_with_defaultsJ   sB   € ô
  “/ˆØ×Ñœ{Ó+ñ 	AØ�M‰M =¸ˆMÔ@÷	A÷ 	Añ 	Aús	    =½Ac                 óâ   — t        d¬«      } |j                  d«      d„ «        |j                  d«      d„ «        |j                  d«      d„ «       | j                  t        |«      d	«       y )
Nr   r   Úfooc                  ó   — y©NTr   r   s    r   ú<lambda>z-TestFormatChecker.test_repr.<locals>.<lambda>U   ó   � r   Úbarc                  ó   — yrK   r   r   s    r   rL   z-TestFormatChecker.test_repr.<locals>.<lambda>V   rM   r   Úbazc                  ó   — yrK   r   r   s    r   rL   z-TestFormatChecker.test_repr.<locals>.<lambda>W   rM   r   z.<FormatChecker checkers=['bar', 'baz', 'foo']>)r   r-   r)   Úreprr   s     r   Ú	test_reprzTestFormatChecker.test_reprS   s`   € Ü¨Ô+ˆØˆ�‰�uÓÑ0Ô1Øˆ�‰�uÓÑ0Ô1Øˆ�‰�uÓÑ0Ô1Ø×ÑÜ�‹MØ<õ	
r   N)Ú__name__Ú
__module__Ú__qualname__r   r    r+   r.   r>   rD   rG   rS   r   r   r   r   r      s+   „ ò+ò.ò
ò
ò:ò	4òAó
r   r   N)Ú__doc__Úunittestr   Ú
jsonschemar   r   Újsonschema.exceptionsr   Újsonschema.validatorsr   rA   r   ÚZeroDivisionErrorr
   r   r   r   r   r   ú<module>r]      s?   ðñõ ç 5Ý -Ý 1á�'Ó€Ù˜Ó!€òôF
˜õ F
r   