`dpdZddlmZddlmZmZmZddlmZe dZ e dZ dZ Gdd eZy ) zH Tests for the parts of jsonschema related to the :kw:`format` keyword. )TestCase) FormatChecker FormatErrorValidationError)Draft4ValidatorzBoom!zBang!c$|dk(rtt)Nbang)BANGBOOMthings >/usr/lib/python3/dist-packages/jsonschema/tests/test_format.pyboomrs  JcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z y ) TestFormatCheckercRtd}|j|jy)Nformats)r assertFalsecheckersselfcheckers rtest_it_can_validate_no_formatsz1TestFormatChecker.test_it_can_validate_no_formatss + ))*rcr|jt5tdgdddy#1swYyxYw)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-6c*ttj}|jtjjdtj dt |jtjt|t dfyNrr)r)dictrr addCleanuppop cls_checksr assertEqual)roriginals r!test_it_can_register_cls_checkersz3TestFormatChecker.test_it_can_register_cls_checkerssf ../  ..22F;(   (.   " " r + rct}|jdt|j|jt tjtdfyr")rchecksrr'rr#rs rtest_it_can_register_checkersz/TestFormatChecker.test_it_can_register_checkers&sG/vt$     ''tRj 9 rct}|jdttt|j t 5}|jddddd|jjjt|j|jjt|j tt5|jdddddy#1swYxYw#1swYyxYw)Nrraises instanceformatr ) rr+typer rrrcheckassertIs exceptioncause __cause__r )rrcms r!test_it_catches_registered_errorsz3TestFormatChecker.test_it_catches_registered_errors.s/1vd4j1$7   { + 6r MM2fM 5 6 bll(($/ bll,,d3  tDz * : MM6&M 9 : : 6 6 : :s C5D5C>D ct}|jdttt ddi|}|j t 5}|jdddd|jjjt|j|jjty#1swY^xYw)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/1vj1$7#Xv$6wO    / '2   v & ' bll(($/ bll,,d3  ' 's B??Cct}|jt5|jdddddy#1swYyxYw)Nz not-an-ipv4ipv4r1)rrrr5rs r'test_format_checkers_come_with_defaultsz9TestFormatChecker.test_format_checkers_come_with_defaultsGsB  /   { + A MM=M @ A A As =Actd}|jdd|jdd|jdd|jt|d y) NrrfoocyNTrr s rz-TestFormatChecker.test_repr..RrbarcyrHrr s rrIz-TestFormatChecker.test_repr..SrJrbazcyrHrr s rrIz-TestFormatChecker.test_repr..TrJrz.)rr+r'reprrs r test_reprzTestFormatChecker.test_reprPs`+u01u01u01  M < rc  ddlm}t}|j|j dd|j|j dd|j |j ddy#t $rYywxYw)Nr) is_durationdurationP4Ytest)jsonschema._formatrRr assertTrueconformsr ImportError)rrRrs rtest_duration_formatz&TestFormatChecker.test_duration_formatZsu C 6$oG OOG,,Q ; < OOG,,UJ? @   W--fjA B    sA66 BBct}|j|jdd|j|jdd|j|jddy)NrSuuidz$6e6659ec-4503-4428-9f03-2e2ea4d6c278rV)rrXrYrrs rtest_uuid_formatz"TestFormatChecker.test_uuid_formates\/ ((F34    CV L  ))&&9:rN) __name__ __module__ __qualname__rr r)r,r;rArDrPr[r^rrrrrs6+.   : 4A  C;rrN)__doc__unittestr jsonschemarrrjsonschema.validatorsrr>r ZeroDivisionErrorr rrrrrrgs?BB1'! W;W;r