rcR dZddlZddlmZmZddlmZddlZeZe dZ e dZ e dZ e d Z e d Ze d Zd Zd ZdZejdkZerdZdZndZejdkrdZeeddZndZdZe e e e de de dejejdZ e e e e de de de dej!ej"d  Z#e e e e de de dej$ej%d!Z&e e e e de d"e d#e de dej'ej(d$ Z)eeeded#ededed%ej*d&'Z+eeej*ej,d(Z-eeeded#ededed%ej.d)'Z/eeej.ej0d*Z1dS)+z Test runner for the JSON Schema official test suite Tests comprehensive correctness of each draft's validator. See https://github.com/json-schema-org/JSON-Schema-Test-Suite for details. N)bugtest_suite_bug)Suitedraft3)namedraft4draft6draft7z draft2019-09z draft2020-12c fd}|S)NchtfdDrSdS)Nc3FK|]\}}|t|kVdSN)getattr).0attrvaluetests M/usr/lib/python3/dist-packages/jsonschema/tests/test_jsonschema_test_suite.py z(skip..skipper..s6NN eud+++NNNNNN)allitems)rkwargsmessages`rskipperzskip..skippers@ NNNNv||~~NNN N N N  r)rrrs`` rskiprs) Nrcfd}|S)Nc|j}|dus|dusd|vs|djvs|jrdSd|dS)NTFformatzFormat checker {0!r} not found.)schemacheckersvalidr )rr!checkers rmissing_formatz&missing_format..missing_format sd dNNv%%h7#333z4 F077x8HIIIrr)r$r%s` rr%r%s) J J J J J rc$|jdkrdSd}t|d|pgt|d|pMt|d|p3t|d|pt|d|S) Nemailz8Complex email validation is (intentionally) unsupported.zan invalid domainr descriptionzan invalid IPv4-address-literalz!dot after local part is not validz"dot before local part is not validz3two subsequent dots inside local part are not valid)subjectrrrs rcomplex_email_validationr,/s  |wHG 4'       t5    t7    t8    tI    riz:Not running surrogate Unicode case, this Python is narrow.c~ttd|pttd|S)Nz7one supplementary Unicode code point is not long enoughr(z4two supplementary Unicode code points is long enough)rrrs rnarrow_unicode_buildr/Jsb tI      4N      rcdSrrr.s rr/r/Ur) zRejecting leading zeros is 3.9+ipv4z5invalid leading zeroes, as they are treated as octalsrr*r)cdSrrr.s rallowed_leading_zerosr7ar1rc"d}t|dd|pt|dd|pt|dd|pt|dd|pt|dd|pt|dd |pkt|dd |pPt|dd |p5t|d d |pt|d d|S)NzLeap seconds are unsupported.timez$a valid time string with leap secondr5z*a valid time string with leap second, Zuluz0a valid time string with leap second with offsetz'valid leap second, positive time-offsetz'valid leap second, negative time-offsetz-valid leap second, large positive time-offsetz-valid leap second, large negative time-offsetz#valid leap second, zero time-offsetz date-timez)a valid date-time with a leap second, UTCz7a valid date-time with a leap second, with minus offset)rr+s r leap_secondr:es -G 4:      ( t@   ( tF   ( t=   ( t=   !( (tC   )( 0tC   1( 8t9   9( @t?   A( HtM   I( rbignumz non-bmp-regexzeroTerminatedFloatsct|pYttj|p7t |p(t t dddd|S)NsrefF5$ref prevents a sibling id from changing the base urirr*r#case_description)r/r% jsonschemadraft3_format_checkerr,rrr.s rrEs{T""  ;>*: ; ;D A A  #D ) )  4HHG        r) Validatorformat_checkerrzfloat-overflowct|pgt|pWt|pGttj|p$t |pttdd|pttddd|pttddd|pttddd |puttddd |pMttd d |p&ttdd |S)Nr?z$Recursive references between schemasrr*rBr>zALocation-independent identifier with base URI change in subschemar@idzmatch $ref to idr5zno match on enum or $ref to id refRemote,base URI change - change folder in subschemazEid must be resolved against nearest parent, not just immediate parent) r/r7r:r%rCdraft4_format_checkerr,rrr.s rrErEsT""/   & &/  t  /  <>*: ; ;D A A/  $D ) ) /   4EEC        /  4HH/       / $ 4HHG       %/ 2 4HH*       3/ < 4HH8       =/ F 4EEK       G/ P 4EE,       Src\t|pt|pt|pttj|p]t |pNttdd|p'ttddd|S)NrKrLrIr>r?6$ref prevents a sibling $id from changing the base uri) r/r7r:r%rCdraft6_format_checkerr,rrr.s rrErEsT""   & &  t    <>*: ; ;D A A  $D ) )    4EEK          4HHH       rcontentz cross-draftct|pAt|p1t|p!ttj|pt |pttdd|pttddd|pttdd|pzttdd d d |pQttdd d d |p(ttdd d d |S)NrKrLrIr>r?rOF$id must be resolved against nearest parent, not just immediate parentiQrQFz8validation of string-encoded content based on media typerAz$validation of binary string-encodingz1validation of binary-encoded media type documents) r/r7r:r%rCdraft7_format_checkerr,rrr.s rrErEsT"".   & &.  t  .  <>*: ; ;D A A.  $D ) ) .   4EEK        .  4HHH       . " 4EE,       #. 2 4HHJ       3. B 4HHC       C. N 4HHC       QrrefOfUnknownKeywordctddd|ptddd|ptddd|ptddd|pctdddd |pFtddd d |p)tddd d |p tddd d |ptdddd |ptddd|ptdddd |ptddd|p}tdddd |p`tdddd |pCtddd|p'tddd|p tddd|ptddd|ptddd|ptddd|ptddd !|ptd"d#d$|pitd"d%d&!|pNttd'd(d)|p&ttd*d+!|S),Nz6unevaluatedItems is different in 2019-09 (needs work).unevaluatedItemsz+uncle keyword evaluation is not significantr5z1when one schema matches and has unevaluated itemsz0when two schemas match and has unevaluated itemsz,when if matches and it has unevaluated itemsz"unevaluatedItems with nested tuplezwith unevaluated items)rr*rBr)zunevaluatedItems with notzunevaluatedItems with oneOfzunevaluatedItems with $refzunevaluatedItems with tuplez2when if doesn't match and it has unevaluated itemsz'recursiveRef support isn't working yet. recursiveRefzL$recursiveRef with no $recursiveAnchor in the initial target schema resourcez9leaf node does not match: recursion uses the inner schemaz2leaf node matches: recursion uses the inner schemazJdynamic $recursiveRef destination (not predictable at schema compile time)z integer nodez3multiple dynamic paths to the $recursiveRef keyword/recurse to integerNode - floats are not allowedz*integer does not match as a property valuez:leaf node does not match: recursion only uses inner schemaz3leaf node matches: recursion only uses inner schemaz6two levels, integer does not match as a property valuezrecursive mismatchztwo levels, no matchrJz4Invalid use of fragments in location-independent $idrI+dynamicRef support isn't fully working yet.defsinvalid definition schemaanchor$same $anchor with different base uri> vocabulary5no validation: invalid number, but it still validatesr?rS)rrrr.s rrErELsn L&E       ]   4L&K        ]  4L&J       ]  4L&F       ] ( 4L&A0       )] 4 4L&80       5] @ 4L&:0       A] L 4L&90       M] X 4L&:0       Y] d 4L&L       e] n 4="5L    o] D 4="L       E] N 4="*'      O] ` 4="EI       a] p 4="D       q] z 4="3       {] J 4="3       K] Z 4="H       [] h 4=",       i] r 4=".       s] | 4=F       }] J 4A3       K] T 4AC       U] ^ 4"3'' G       _] l 4EE,       or)rFrct|pNt|p?t|p0ttj|pt|Sr)r,r7r:r%rCdraft201909_format_checkerr.s rrErEd && *  & & * t   * A>*? @ @ F F * $D ) ) rc"t|ptddd|pctdddd|pFtdddd|p)tdddd |p tdddd |ptddd |ptddd |ptddd |ptddd |ptdd d|pitddd|pNttddd|p&ttdd|S)NrZ dynamicRefz0The recursive part is not valid against the rootr5zincorrect extended schemaz>$ref and $dynamicAnchor are independent of order - $defs first)rr*r)rBzcorrect extended schemaz=$ref and $dynamicAnchor are independent of order - $ref firstz8/then/$defs/thingy is the final stop for the $dynamicRefzDstring matches /$defs/thingy, but the $dynamicRef does not stop hererYr[r\r]r^rIr_r`rar?rS)r/rrrr.s rrErEsT""\  4A J       \   4A 3        \  4A 1       \ 0 4A 1O       1\ @ 4A 3O       A\ P 4A J       Q\ ^ 4A %       _\ n 4A %       o\ ~ 4A I       \ H 4A3       I\ R 4AC       S\ \ 4"3'' G       ]\ j 4EE,       mrct|pNt|p?t|p0ttj|pt|Sr)r,r7r:r%rCdraft202012_format_checkerr.s rrErEkrdr)2__doc__sysjsonschema.tests._helpersrrjsonschema.tests._suiterrCSUITEversionDRAFT3DRAFT4DRAFT6DRAFT7 DRAFT201909 DRAFT202012rr%r, maxunicodeis_narrow_buildrr/ version_infor7r:to_unittest_testcasetests format_testsoptional_tests_ofDraft3ValidatorrD TestDraft3Draft4ValidatorrM TestDraft4Draft6ValidatorrP TestDraft6Draft7ValidatorrT TestDraft7Draft201909ValidatorTestDraft201909rcTestDraft201909FormatDraft202012ValidatorTestDraft202012rhTestDraft202012Formatrrrrs 99999999))))))  H % % H % % H % % H % %mmm00 mmm00        ..K/JG    f/G DK * * * Z ( ( LLNN  (++ /22 "899(3  ) 0 ( ( LLNN  (++ "233 /22 "899(31 1 );; | ( ( LLNN  (++ "233 /22(3  ) < ( ( LLNN  (++ ),, -00 "233 /22(30 0 );; |22!!x!00!!}!55!!'7!88!!!77!!'<!==-_ _ 3hhV$88-8   9  22!!x!00!!}!55!!'7!88!!!77!!'<!==-^ ^ 3ggT$88-8   9  r