rcdZddlmZddlmZmZmZddlmZe dZ e dZ dZ Gdd eZd S) zH Tests for the parts of jsonschema related to the :kw:`format` keyword. )TestCase) FormatChecker FormatErrorValidationError)Draft4ValidatorzBoom!zBang!c*|dkrtt)Nbang)BANGBOOMthings >/usr/lib/python3/dist-packages/jsonschema/tests/test_format.pyboomrs  JcJeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) TestFormatCheckercZtd}||jdS)Nformats)r assertFalsecheckersselfcheckers rtest_it_can_validate_no_formatsz1TestFormatChecker.test_it_can_validate_no_formatss/+++ )*****rc|t5tdgddddS#1swxYwYdS)Nzo noesr) assertRaisesKeyErrorr)rs r.test_it_raises_a_key_error_for_unknown_formatsz@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formatss   x ( ( . . 8* - - - - . . . . . . . . . . . . . . . . . .s :>>c2ttj}|tjjdtjdt |tjt|t dfdSNrr)r)dictrr addCleanuppop cls_checksr assertEqual)roriginals r!test_it_can_register_cls_checkersz3TestFormatChecker.test_it_can_register_cls_checkerss .//  .2F;;;(  ((...   " r + + +     rct}|dt||jt tjtdfdSr")rchecksrr'rr#rs rtest_it_can_register_checkersz/TestFormatChecker.test_it_can_register_checkers&sf//vt$$$    'tRj 9 9 9     rcdt}|dttt|t 5}|dddddn #1swxYwY||j j t||j j t|tt5|ddddddS#1swxYwYdS)Nrraises instanceformatr ) rr+typer rrrcheckassertIs exceptioncause __cause__r )rrcms r!test_it_catches_registered_errorsz3TestFormatChecker.test_it_catches_registered_errors.sw//1vd4jj11$777   { + + 6r MM2fM 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 bl($/// bl,d333  tDzz * * : : MM6&M 9 9 9 : : : : : : : : : : : : : : : : : :s$ BB BD%%D),D)ct}|dttt ddi|}|t 5}|ddddn #1swxYwY||j j t||j j tdS)Nrr.r3)format_checkerr ) rr+ ValueErrorrrrrvalidater6r7r8r r9)rr validatorr:s r7test_format_error_causes_become_validation_error_causeszITestFormatChecker.test_format_error_causes_become_validation_error_causes<s//1vj11$777#Xv$6wOOO    / / '2   v & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' bl($/// bl,d33333s&BB B ct}|t5|ddddddS#1swxYwYdS)Nz not-an-ipv4ipv4r1)rrrr5rs r'test_format_checkers_come_with_defaultsz9TestFormatChecker.test_format_checkers_come_with_defaultsGs  //   { + + A A MM=M @ @ @ A A A A A A A A A A A A A A A A A AsAAAc&td}|dd|dd|dd|t|d dS) NrrfoocdSNTrr s rz-TestFormatChecker.test_repr..RDrbarcdSrHrr s rrIz-TestFormatChecker.test_repr..SrJrbazcdSrHrr s rrIz-TestFormatChecker.test_repr..TrJrz.)rr+r'reprrs r test_reprzTestFormatChecker.test_reprPs+++u00111u00111u00111  MM <     rcH ddlm}t}||dd||dd||dddS#t $rYdSwxYw)Nr) is_durationdurationP4Ytest)jsonschema._formatrRr assertTrueconformsr ImportError)rrRrs rtest_duration_formatz&TestFormatChecker.test_duration_formatZs C 6 6 6 6 6 6$ooG OOG,,Q ;; < < < OOG,,UJ?? @ @ @   W--fjAA B B B B B     DD sB B! B!ct}||dd||dd||dddS)NrSuuidz$6e6659ec-4503-4428-9f03-2e2ea4d6c278rV)rrXrYrrs rtest_uuid_formatz"TestFormatChecker.test_uuid_formates// ((F33444    CV L L    ))&&99:::::rN) __name__ __module__ __qualname__rr r)r,r;rArDrPr[r^rrrrrs+++...       : : : 4 4 4AAA    C C C;;;;;rrN)__doc__unittestr jsonschemarrrjsonschema.validatorsrr>r ZeroDivisionErrorr rrrrrrgsBBBBBBBBBB111111z'!! W;W;W;W;W;W;W;W;W;W;r