`d&ddlmZddlmZmZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlZddlZddlZddlZddl Z ddlZddlZdd lmZmZmZmZmZdd lmZd ZGd d e ZGdde Z Gdde Z!Gdde"Z#Gdde#e"Z$Gdde"Z%Gdde%e$e Z&Gdde%e$e Z'Gdde$e Z(Gdde$e Z)Gd d!e$e Z*Gd"d#e$e Z+Gd$d%e Z,Gd&d'e Z-Gd(d)e Z.d*Z/ej`Gd+d,e"Z1ej`Gd-d.e"Z2y)/) annotations)deque namedtuple)contextmanager)Decimal)BytesIO)TestCasemock) pathname2urlN) FormatChecker TypeChecker exceptions protocols validators)bugc#lK|D]+}|jddtjdi|-yw)NmessagezYou told me to fail!) setdefaultrValidationError) validatorerrorsinstanceschemaeachs B/usr/lib/python3/dist-packages/jsonschema/tests/test_validators.pyfailrs81  #9:((04001s24creZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZy)TestCreateAndExtendcH|j|jtjt tjddi|_dt i|_t|_tj|j |j|j|_ y)N$idzsome://meta/schemar) meta_schemar type_checker) addCleanup assertEqualr _META_SCHEMASdictr"rr r#create Validatorselfs rsetUpzTestCreateAndExtend.setUp#s~      $ $ )) * "#78!4.'M#**((** c|j|jj|jj|jjf|j |j |jfyN)r%r) VALIDATORS META_SCHEMA TYPE_CHECKERrr"r#r*s r test_attrszTestCreateAndExtend.test_attrs3s\ ))**++    !! r-cbdgi}|j|j|j|y)Nr)r%r)rr+rs r test_initzTestCreateAndExtend.test_init@s*" /66?r-cdgi}|j|}t|jd}|j|gy)Nrhello)r)list iter_errorsr%r+rrrs rtest_iter_errors_successfulz/TestCreateAndExtend.test_iter_errors_successfulDs>"NN6* i++G45 $r-c Pdddigi}|j|}tjdd|dddigtdg}t |j d}|j t|d|j |dj|jy)NrrzWhoops!goodbye)rrrvalidator_value schema_pathr) r)rrrr9r:r%len _contents)r+rrexpected_errorrs rtest_iter_errors_one_errorz.TestCreateAndExtend.test_iter_errors_one_errorKsIy123NN6* #33 '34vh  i++I67 Va( ,,.0H0H0JKr-cdddidddddigi}|j|}t|jd}|jt |d y) NrrFirstzSecond!asdf)rrThirdr>)r)r9r:r%rBr;s r test_iter_errors_multiple_errorsz4TestCreateAndExtend.test_iter_errors_multiple_errors\sb G$%F;G$ NN6* i++I67 Va(r-ctjddid}|jtjjd|j |j d|j |jdy)Nr! something my versionr"versionMyVersionValidator)rr(r$r&popr%__name__ __qualname__r+r)s r.test_if_a_version_is_provided_it_is_registeredzBTestCreateAndExtend.test_if_a_version_is_provided_it_is_registeredisg%% ,    0044kB ++-AB //1EFr-ctjddid}|jtjjd|j t |idy)Nr!rMrNrOz2MyVersionValidator(schema={}, format_checker=None))rr(r$r&rRr%reprrUs r test_reprzTestCreateAndExtend.test_reprrsV%% ,    0044kB  2  @ r-c tjddid}|jtjjd|j t |dttdidy)Nr!rMrNrOaizNMyVersionValidator(schema={'a': [0, 1, 2, 3, 4, 5, ...]}, format_checker=None)) rr(r$r&rRr%rXr9rangerUs rtest_long_reprz"TestCreateAndExtend.test_long_repr}sg%% ,    0044kB  CeDk!234 5' r-crtji}|jt|idy)Nr"z)Validator(schema={}, format_checker=None))rr(r%rXrUs rtest_repr_no_versionz(TestCreateAndExtend.test_repr_no_versions/%%"5   2  7 r-ctjddid}|jtjjd|j |j dy)Nr!rMzfoo-barrOFooBarValidator)rr(r$r&rRr%rTrUs r-test_dashes_are_stripped_from_validator_nameszATestCreateAndExtend.test_dashes_are_stripped_from_validator_namessP%% ,   0044kB //1BCr-cttj}tjddi|j tj|y)Nidr_)r'rr&r(r%)r+originals r6test_if_a_version_is_not_provided_it_is_not_registeredzJTestCreateAndExtend.test_if_a_version_is_not_provided_it_is_not_registereds: 001tTl3 118zMTestCreateAndExtend.test_validates_registers_meta_schema_id..AEE$Or-r"rPid_ofrr(r$r&rRassertInr+meta_schema_keymy_meta_schemas r'test_validates_registers_meta_schema_idz;TestCreateAndExtend.test_validates_registers_meta_schema_idsX*0& +  0044oF oz'?'?@r-cd}d|i}tj|d|jtjj||j |tjy)Nmeta schema $idr!rNrOrurws r.test_validates_registers_meta_schema_draft6_idzBTestCreateAndExtend.test_validates_registers_meta_schema_draft6_idsU+1&    0044oF oz'?'?@r-c tjid|jtfddgfddddd ifd fDy) Nr)r"rc3VK|] \}}ij||"yw))rtypeN)is_type).0rrr)s r z@TestCreateAndExtend.test_create_default_types..s1 "D(" %%xd%C s&)array)booleanT)integer )nullN)numberg(@object)stringfoo)rr( assertTrueallrUs @rtest_create_default_typesz-TestCreateAndExtend.test_create_default_typessW%%"D    bM%#"$rN%'   r-ct|jj}t}t j |jd|i}|j |j|j|j|jjft|||jj|jj|fy)Nnew)r)r) r'r)r0rrextendr%r1r2)r+rfrExtendeds r test_extendzTestCreateAndExtend.test_extends112h$$ NNs|  ##$$%%))   X3'**++  r-cNfd}d}d|d}tj|jj|}j|j |j |tj |}j|j |j |y)zK Extending a validator preserves its notion of schema IDs. cZ|jdjj|S)N__test__)rnr)ID_OF)rr+s rrtz3TestCreateAndExtend.test_extend_idof..id_ofs#::j$..*>*>v*FG Gr-zthe://correct/id/zthe://wrong/id/)r!r)r"rr#rtN)rr(r#r%rr1r)r+rt correct_idr"OriginalDeriveds` rtest_extend_idofz$TestCreateAndExtend.test_extend_idofs H( $" $$#**   (<(<=zJ##H- w':':;ZHr-N)rS __module__rTr,r3r6r<rErKrVrYr]r`rcrgrzr}rrrrr-rrr"s^  @%L" )G     D= A A " ,Ir-rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.y-).TestValidationErrorMessagesc:|jdtj}|j|||g|i|}t |j |}|j |d||jt|dd||djS)NclszNo errors were raised for )msgrAz"Expected exactly one error, found r) rRr_LATEST_VERSION check_schemar9r:rr%rBr)r+rrargskwargsrrrs r message_forz'TestValidationErrorMessages.message_forsjj : :;  000 i++H56 &@ $MN  K 4VJ?  ay   r-cR|jdddi}|j|dyNrArrrr1 is not of type 'string'rr%r+rs rtest_single_type_failurez4TestValidationErrorMessages.test_single_type_failures-""Avx6H"I "=>r-cT|jdddgi}|j|dyrrrs rtest_single_type_list_failurez9TestValidationErrorMessages.test_single_type_list_failures/""Avz6J"K "=>r-chd}|jddt|i}|j|dy)N)rrrArrz#1 is not of type 'string', 'object')rr9r%)r+typesrs rtest_multiple_type_failurez6TestValidationErrorMessages.test_multiple_type_failure s6"""AvtE{6K"L "GHr-c|ddddgi}|jd|tj}|j|dy)NrFoorJ)nameminimumrArrrz1 is not of type 'Foo'rrDraft3Validatorr%r+rrs r#test_object_with_named_type_failurez?TestValidationErrorMessages.test_object_with_named_type_failuresKEa89:""**#  ":;r-cR|jdddi}|j|dy)NrArrz1 is less than the minimum of 2rrs r test_minimumz(TestValidationErrorMessages.test_minimums,""Ay!n"E "CDr-cR|jdddi}|j|dy)NrAmaximumrrz"1 is greater than the maximum of 0rrs r test_maximumz(TestValidationErrorMessages.test_maximums,""Ay!n"E "FGr-cd\}}d||ii}|jddi|tj}|j|dyNbarr dependenciesrrrz'foo' is a dependency of 'bar'rr+dependonrrs r test_dependencies_single_elementz""SE:**#  *G4r-cv|jgdgddtj}|jd|y)NrArrJFrrz(1, 2, 3 were unexpected)rrs r&test_additionalItems_multiple_failureszBTestValidationErrorMessages.test_additionalItems_multiple_failuresSs<""E:**#  17;r-c^d}ddi}|j|di|}|jd|y)NradditionalPropertiesFrrz('foo' was unexpected)rrv)r+ additionalrrs r(test_additionalProperties_single_failurezDTestValidationErrorMessages.test_additionalProperties_single_failure[s9 (%0""ZOF"K .8r-cddi}|jtjddg|}|jt d||jt d||jd|y)NrFrrrzwere unexpected))rr'fromkeysrvrXrs r+test_additionalProperties_multiple_failureszGTestValidationErrorMessages.test_additionalProperties_multiple_failuresasi(%0""]]E5>2#  d5k7+ d5k7+ ('2r-cZddi}|jddi|}|jd|y)Nconstrrrrz12 was expectedrrs r test_constz&TestValidationErrorMessages.test_constls;2""U^#  '1r-c~dddii}|jdigg|tj}|j|dy)Ncontainsrrrrz4None of [2, {}, []] are valid under the given schema)rrDraft6Validatorr%rs rtest_contains_draft_6z1TestValidationErrorMessages.test_contains_draft_6tsPwm,""R[**#    B r-c td}|jddddi}|jd||}|jt d||jt d||jd|y) Nr)formatsthingcyNFr)values rrqzQTestValidationErrorMessages.test_invalid_format_default_message..sr-formatbla)rrformat_checkerzis not a)r checksrrvrX)r+checkerrrs r#test_invalid_format_default_messagez?TestValidationErrorMessages.test_invalid_format_default_messages|+w 34G$"""#  d5k7+ d7mW- j'*r-c ddddiddidd}|jddi|tj }|j|d j t dt d t d |jdd d|tj }|j|dj t dt dt d t d y)NrFrr)^abc$^def$)rrpatternPropertieszebra{rz,{} does not match any of the regexes: {}, {}rri)rfishz.{}, {} do not match any of the regexes: {}, {}r)rrDraft4Validatorr%rrXrs r1test_additionalProperties_false_patternPropertieszMTestValidationErrorMessages.test_additionalProperties_false_patternPropertiess"*/ &1 &1( ""s^**#    : A AW tG}d7m  """C0**#    < C CV d7mT']DM  r-cN|jdd}|j|dy)NrMFrz'False schema does not allow 'something'rrs rtest_False_schemaz-TestValidationErrorMessages.test_False_schemas0"" #  "KLr-cR|jdddi}|j|dy)NrJ multipleOfrrz3 is not a multiple of 2rrs rtest_multipleOfz+TestValidationErrorMessages.test_multipleOfs5"" !$#  "<=r-cR|jgddi}|j|dy)NminItemsrrz[] is too shortrrs r test_minItemsz)TestValidationErrorMessages.test_minItemss,""B A"G "34r-cV|jgdddi}|j|dy)NrmaxItemsrrz[1, 2, 3] is too longrrs r test_maxItemsz)TestValidationErrorMessages.test_maxItemss,""Iz1o"N "9:r-c\|jgddiigd}|j|dy)NrArrFr prefixItemsrz%Expected at most 2 items, but found 4rrs rtest_prefixItems_with_itemsz7TestValidationErrorMessages.test_prefixItems_with_itemss9""%"B8<#  "IJr-cR|jdddi}|j|dy)Nrl minLengthrrz'' is too shortrrs rtest_minLengthz*TestValidationErrorMessages.test_minLengths5""##  "34r-cR|jdddi}|j|dy)Nabc maxLengthrrz'abc' is too longrrs rtest_maxLengthz*TestValidationErrorMessages.test_maxLengths5""##  "56r-cR|jdddi}|j|dy)Nbbbpatternz^a*$rz'bbb' does not match '^a*$'rrs r test_patternz(TestValidationErrorMessages.test_patterns5""v&#  "?@r-cV|jgdddii}|j|dy)Nrrrrz3[] does not contain items matching the given schemarrs rtest_does_not_containz1TestValidationErrorMessages.test_does_not_contains="" 23#    A r-c\|jddgddidd}|j|dy) NrrArrrr minContainsrMToo few items match the given schema (expected at least 2 but only 1 matched)rrs rtest_contains_too_fewz1TestValidationErrorMessages.test_contains_too_fewsC""QZ!' 21E#    7 r-c^|jddgddiddd}|j|d y) NrrArrrrr! maxContainsrr"rrs r&test_contains_too_few_both_constrainedzBTestValidationErrorMessages.test_contains_too_few_both_constrainedsI""QZ#X.  #     r-c\|jgdddidd}|j|dy)Nrrbazrrrrr'r:Too many items match the given schema (expected at most 2)rrs rtest_contains_too_manyz2TestValidationErrorMessages.test_contains_too_manys=""*!' 21E#    H r-cb|jdgdzddiddd}|j|d y) Nrrrrrr%r&rz:Too many items match the given schema (expected at most 4)rrs r'test_contains_too_many_both_constrainedzCTestValidationErrorMessages.test_contains_too_many_both_constrained sI""Wq[#X.  #    H r-cR|jdddi}|j|dy)NrJexclusiveMinimumrrz+3 is less than or equal to the minimum of 5rrs rtest_exclusiveMinimumz1TestValidationErrorMessages.test_exclusiveMinimums8""&*#    9 r-cR|jdddi}|j|dy)NrJexclusiveMaximumrrz.3 is greater than or equal to the maximum of 2rrs rtest_exclusiveMaximumz1TestValidationErrorMessages.test_exclusiveMaximum%s1""A7I16M"N   < r-cT|jiddgi}|j|dy)Nrequiredrrz'foo' is a required propertyrrs r test_requiredz)TestValidationErrorMessages.test_required,s/""B UG7L"M "@Ar-c\|jdiidddgii}|j|dy)NrdependentRequiredrrz'bar' is a dependency of 'foo'rrs rtest_dependentRequiredz2TestValidationErrorMessages.test_dependentRequired0s@""R['%%)9:#  "BCr-cR|jiddi}|j|dy)N minPropertiesrrz"{} does not have enough propertiesrrs rtest_minPropertiesz.TestValidationErrorMessages.test_minProperties7s-""B7K"L "FGr-cZ|jiiidddi}|j|dy)N)r[bc maxPropertiesrrz3{'a': {}, 'b': {}, 'c': {}} has too many propertiesrrs rtest_maxPropertiesz.TestValidationErrorMessages.test_maxProperties;s?""BR0#Q'#    A r-cT|jiddgi}|j|dy)NoneOfFrz.{} is not valid under any of the given schemasrrs rtest_oneOf_matches_nonez3TestValidationErrorMessages.test_oneOf_matches_noneEs2""B%7I"J   < r-cV|jidddgi}|j|dy)NrFTrz${} is valid under each of True, Truerrs rtest_oneOf_matches_too_manyz7TestValidationErrorMessages.test_oneOf_matches_too_manyLs1""B$7N"O "HIr-c\ddd}|jddg|}|j|dy)NrFrunevaluatedItemsrrrz@Unevaluated items are not allowed ('bar', 'foo' were unexpected)rrs rtest_unevaluated_itemsz2TestValidationErrorMessages.test_unevaluated_itemsPs7!u=""UEN6"J  N r-cXddd}|jd|}|j|dy)NrFrKrrz'foo' is not of type 'array'rrs r&test_unevaluated_items_on_invalid_typezBTestValidationErrorMessages.test_unevaluated_items_on_invalid_typeXs2!u=""E&"A "@Ar-c^ddd}|jddd|}|j|dy) NrFrunevaluatedPropertiesrrrrrzEUnevaluated properties are not allowed ('bar', 'foo' were unexpected)rrs rtest_unevaluated_propertiesz7TestValidationErrorMessages.test_unevaluated_properties]sI"UC"" #    - r-cXddd}|jd|}|j|dy)NrFrQrrz'foo' is not of type 'object'rrs r+test_unevaluated_properties_on_invalid_typezGTestValidationErrorMessages.test_unevaluated_properties_on_invalid_typels2"UC""E&"A "ABr-N)/rSrrTrrrrrrrrrrrrrrrrrrrrrrr rrrrrr#r(r.r0r3r6r9r<r?rDrGrIrMrOrTrVrr-rrrs !??I <EHD  DD5<9 32   + <M>5;K57A          BDH  J B  Cr-rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZy)TestValidationErrorDetailsc6 d}dddiddigi}tj|}t|j|}|j t |d|d}|j |j d|j |j|d|j |j||j |j||j|j|j |jtg|j |jtg|j |jtg|j |j d |j |j"tdg|j |j$tdg|j |j&tdg|j t |j(d t+|j(\}}|j |j d|j |j|ddd|j |j||j |j|dd|j-|j||j |jtg|j |jtg|j |jtg|j |j d |j |j"tddg|j |j$tddg|j |j&tgd |j/|j(|j |j d|j |j|ddd|j |j||j |j|dd|j-|j||j |jtg|j |jtg|j |jtg|j |j d |j |j"tddg|j |j$tddg|j |j&tgd |j t |j(dy) NranyOfrrrrAr$r)rZrr)rZrAr)rrr9r:r%rBrr?rr assertIsNoneparentpathr relative_path absolute_path json_pathr@relative_schema_pathabsolute_schema_pathcontext sorted_errorsassertIs assertFalser+rrrree1e2s r test_anyOfz%TestValidationErrorDetails.test_anyOfusA B" ..v6 i++H56 Va( 1I g. **F7O< X. 6* !((# r+ %)4 %)4 c* wi(89 //y1AB //y1AB QYY+qyy)B y1 ++VG_Q-? -JK h/ F7OA$67 bii# %), ))595 ))595 s+ 9~)>? 00%I2GH   # #U+B%C  $ v. ++VG_Q-?-GH h/ F7OA$67 bii# %), ))595 ))595 s+ 6{);< 00%F 2DE 00%8L2MN RZZ!,r-c" ddi}dddiddddgiidgi}tj|}t|j|}|j t |d|d }|j |j d|j |j|d|j |j||j |j||j|j|j |jtg|j |jtg|j |jtg|j |j d |j |j"tdg|j |j$tdg|j |j&tdg|j t |j(dt+|j(\}}|j |j d|j |j|dd d|j |j||j |j|dd |j-|j||j |jtg|j |jtg|j |jtg|j |j d |j |j"td dg|j |j$td dg|j |j&tgd |j/|j(|j |j d|j |jdg|j |jd|j |jddgi|j-|j||j |jtdg|j |jtdg|j |jtdg|j |j d |j |j"tgd |j |j$tgd |j |j&tgd|j/|j(y)NrrArrrenumrr propertiesrr\)rrr$.foo)rArqrro)rrArqrro)rrr9r:r%rBrr?rrr]r^r_rr`rarbr@rcrdrerfrgrhris r test_typez$TestValidationErrorDetails.test_typesG1: #$#(6A3-"8 ..v6 i++H56 Va( 1I f- **F6N; X. 6* !((# r+ %)4 %)4 c* vh8 //xA //xA QYY+qyy)B v. ++VF^A->v-FG h/ F6N1$56 bii# %), ))595 ))595 s+ 6{);< 00%F 2DE 00%8K2LM $ v. ++aS1 a( VaSM2 bii# %.1 ))5%>: ))5%>: w/  NNE"BC    # #U+K%L    # # : ; $r-cddgddd}dddid did gd d d i}tj|}|j|}t|\}}}}|j |j t dg|j |j t dg|j |j t dg|j |j t dg|j |jt dg|j |jt dg|j |jt dg|j |jt dg|j |jt dg|j |jt dg|j |jt dg|j |jt dg|j |jd|j |jd|j |jd|j |jd|j |jd |j |jd|j |jd|j |jdy)NrrAspam)rrr+quuxrqrrr )rr%)rror*rr+r$.barz$.bazrrror) rrr:rfr%r_rr`rarbr) r+rrrrrkrle3e4s rtest_single_nestingz.TestValidationErrorDetails.test_single_nestingsTaSVD )"A#%|< ..v6 &&x0&v.BB %.1 %.1 %.1 %.1 ))5%>: ))5%>: ))5%>: ))5%>: ))5%>: ))5%>: ))5%>: ))5%>: w/ w/ w/ w/ z2 v. y1 v.r-cddddgiddg}dddgddd gid d d id diddddd}tj|}|j|}t|\}}}}} } |j |j t g|j |j t dg|j |j t ddg|j |j t gd|j | j t gd|j | j t ddg|j |jd|j |jd|j |jd|j |jd|j | jd|j | jd|j |jt dg|j |jt ddg|j t|jgd|j t|jgd|j t| jgd |j t| jgd!|j |jd|j |jd|j |jd|j |jd |j | jd |j | jdy)"NrArr+rSrwrrrorJrr8Tr)rr+rp)rrrr)rArr)rArr+rr\$[0]z$[1].barz $[1].bar.barz $[1].bar.bazz$[1].foorr)rrqrr)rrqrrqrr8)rrqrrqr+r)rrqrro) rrr:rfr%r_rrbr@r9r) r+rrrrrkrlr|r}e5e6s rtest_multiple_nestingz0TestValidationErrorDetails.test_multiple_nesting.sq%!6?!8,"QF+ '$.#5$.?'   "..v6 &&x0!.v!6BBB %), %*- %E "34 %(9":; %(9":; %E "34 s+ v. z2 ~6 ~6 z2 x9 /@)AB   "H    K    K    "H  v. v. v. z2 z2 v.r-c ldddddgddiddd d iid d d giiddgdd d iid}dddddddiid id i}tj|}|j|\}|j|jt dg|j|j t gd|j|jd|j\}|j|jt gd|j|j t gd|j|jd|j\}|j|jt gd|j|j t gd|j|jdy)NnoderZrrchildrenrr^.*$$refz#/definitions/node)rr)rr)rr8rqroot) definitionsrr8rqr[ab)rqrrZz$.root)rrr[) rqrrZrrqrrrrZz$.root.children.a)rrr[rr)rqrrZrrqrrrrZrrqrrrrZz$.root.children.a.children.ab) rrr:r%rarrdrbre)r+rrrrjrkrls rtest_recursivez)TestValidationErrorDetails.test_recursiveks (%+Z$8!'%)1$*(.0D-&6") '*!F,@#AB1 8  # &#%    ..v6  " "8 , %/:  " "E*I$J  h/ii ))51J+KL   # #U  &  ':;jj    e;   # #U& * 'FGr-cddd}ddddi}tj|}|j|}t|\}}|j |j t dg|j |j t dg|j |jd |j |jd |j |jd |j |jd y) Nrrrrrrrrrr{rrrr rrr:rfr%r_rrbrr+rrrrrkrls rtest_additionalPropertiesz4TestValidationErrorDetails.test_additionalPropertiess +(9*KL..v6 &&x0v&B %.1 %.1 w/ w/ v. y1r-cddd}dddiddidi}tj|}|j|}t|\}}|j |j t d g|j |j t d g|j |jd |j |jd |j |jd|j |jdy) NrArrrrrrrrrr{rrrrs rtest_patternPropertiesz1TestValidationErrorDetails.test_patternPropertiessQ' )!1~" ..v6 &&x0v&B %.1 %.1 w/ w/ v. y1r-cddg}gdddd}tj|}|j|}t|\}}|j |j t dg|j |j t dg|j |jd|j |jd |j |jd |j |jd y) NrrArrrrrr$[1]rrrrs rtest_additionalItemsz/TestValidationErrorDetails.test_additionalItemss1:(1a@  ..v6 &&x0v&B %*- %*- v. v. v. y1r-cgd}igdddd}tj|}|j|}t|\}}|j |j t dg|j |j t dg|j |jd|j |jd |j |jd |j |jd y) N)rrrArrrrrArrz$[2]rrrrs rtest_additionalItems_with_itemsz:TestValidationErrorDetails.test_additionalItems_with_items s$T(1a@  ..v6 &&x0v&B %*- %*- v. v. v. y1r-cddi}ddddiii}tj|}|j|\}|j|jd|j|j d|j|j tg|j|jd|j|jtddgy)Nrr propertyNamesnotrz0'foo' should not be valid under {'const': 'foo'}r\ rrr:r%rrr_rrbr@)r+rrrerrors rtest_propertyNamesz-TestValidationErrorDetails.test_propertyNamess2;!EGU+;#<=..v6 &&x0 %0  MM >  U2Y/ #. **E?E2J,KLr-cddiddid}tj|}|jd\}|j|jd|j|j d|j|j tg|j|jd|j|jtddgy)Nrr )ifthen13 was expectedr\rrr+rrrs r test_if_thenz'TestValidationErrorDetails.test_if_then/B-bM  ..v6 &&r* '2 (9: U2Y/ #. **E672C,DEr-cddiddid}tj|}|jd\}|j|jd|j|j d|j|j tg|j|jd|j|jtddgy) Nrrr)relserurr\rrrs r test_if_elsez'TestValidationErrorDetails.test_if_else>rr-c 2tjd}|jd\}|j|j|j |j |j|j|j|jfdddddtgdfy)NFrzFalse schema does not allow 12r\) rrr:r%rrr?rrr@rbr)r+rrs rtest_boolean_schema_Falsez4TestValidationErrorDetails.test_boolean_schema_FalseMs..u5 &&r*  %% !! 1b   r-c ddddii}}tjd|itjdi||i}|jd d i\}|j |j |j |j|j|j|j|j|jfd ddd td gdditddgd fy) NsomeRefrrrrrlstoreresolverr notAnIntegerz''notAnInteger' is not of type 'integer'rr)rr RefResolverr:r%rrr?rrarr@rbr)r+refrrrs rtest_refz#TestValidationErrorDetails.test_reffs"869:M!NV.. SM++B3-H &&~'>?  %%## !! :ug#-v67  r-c dddiiiddigi}tj|}|jgd\}}|j|j|j |j |j|j|j|j|jfddddtd gdditgd d f|j|j|j |j |j|j|j|j|jfd ddd tdgdditgddfy)NrrrrrJr rrAr)rrrrz"5 is greater than the maximum of 3r)rrJr$[3] rDraft202012Validatorr:r%rrr?rrarr@rbr)r+rr type_error min_errors rtest_prefixItemsz+TestValidationErrorDetails.test_prefixItemss[68"4b"y!n!MN33F; ) 5 56F G I ""$$**##((!!&&$$ ,qc "01  , !!##))""''  %%## 5qc A34  r-c ddiigd}tj|}|jgd\}}|j|j|j |j |j|j|j|j|jfddddtdgdditddgd f|j|j|j |j |j|j|j|j|jfd ddd td gdditddgd fy)Nrrr)rrrr%r+z2 is not of type 'string'rrArrz4 is not of type 'string'r%rJrrr+rrrkrls rrz6TestValidationErrorDetails.test_prefixItems_with_itemssEh'4 33F; &&'BCB   ""      ,qc "w'(  ,   ""      ,qc "w'(  r-c ~ddidd}tj|}|jgd\}|j|j|j |j |j|j|j|j|jfdddgdtgddiddtdgd fy ) z `contains` + `maxContains` produces only one error, even if there are many more incorrectly matching elements. rrrr,)rrrr%r+rwr-r'rr\Nrrs rr.z1TestValidationErrorDetails.test_contains_too_manys &x0C33F; &&'JK  %%## !! M3b $h/Bzl#  r-c ~ddidd}tj|}|jgd\}|j|j|j |j |j|j|j|j|jfdddgdtgddiddtdgd fy) Nrrrr )rrr%r"r!rr\rrs rr#z0TestValidationErrorDetails.test_contains_too_few s%x0C33F; &&}5  %%## !! ?b $h/Bzl#  r-c ddidd}tj|}|jddg\}|j|j|j |j |j|j|j|j|jfddddiddgtgddiddtdgdfy) Nrrrr r%z7[2, 4] does not contain items matching the given schemarr\rrs rtest_contains_nonez-TestValidationErrorDetails.test_contains_none's%x0C33F; &&1v.  %%## !! J"Ab $h/Bzl#  r-cdddgiidddgdid}tj|}|jdii\}}|j|j|j |j |j|j|j|j|j|jf d ddgitdgddgitgd tgd d f |j|j|j |j |j|j|j|j|j|jf d ddgitdgddgdtgd tgd d f y) Nrr8rapropz #/$defs/foor+)rr8)z$defsrqz'bar' is a required property)rqrr8z$.apropz'baz' is a required property)rrr:r%rrr?rrarr@rcrbrrs rtest_ref_siblingz+TestValidationErrorDetails.test_ref_siblingBsj5'23)!& 33F; &&}5B   ""    ''  /wi eW%9:9:  0   ""    ''  /wi &UG<9:9:  r-N)rSrrTrmrsr~rrrrrrrrrrrrrr.r#rrrr-rrXrXrstC-JK%Z%/N;/zcHJ2"2,2(2(M F F 2 >/ b2 h > < 6< r-rXc$eZdZdZdZdZdZy)MetaSchemaTestsMixinc|jtj5|jj ddidddy#1swYyxYw)Nrqr assertRaisesr SchemaErrorr)rr*s rtest_invalid_propertiesz,MetaSchemaTestsMixin.test_invalid_propertiessB   z55 6 < NN ' 'r(: ; < < < AAc|jtj5|jj ddidddy#1swYyxYw)Nr1rr*s rtest_minItems_invalid_stringz1MetaSchemaTestsMixin.test_minItems_invalid_stringsB   z55 6 ; NN ' 'S(9 : ; ; ;rc>|jjdgiy)zk Technically, all the spec says is they SHOULD have elements, not MUST. See #529. roNr)rr*s rtest_enum_allows_empty_arraysz2MetaSchemaTestsMixin.test_enum_allows_empty_arrayss ##VRL1r-cB|jjdddgiy)zg Technically, all the spec says is they SHOULD be unique, not MUST. See #529. rorNrr*s r!test_enum_allows_non_unique_itemsz6MetaSchemaTestsMixin.test_enum_allows_non_unique_itemss ##Vb"X$67r-N)rSrrTrrrrrr-rrrs<; 28r-rc~eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZy)ValidatorTestMixincb|j|jitjyr/)assertIsInstancer)rr*s r)test_it_implements_the_validator_protocolz>68"4x>H h' C+r-c@tjGdd|j}|id}|j|jgd|j ddi}|j|jgd|j|j dy ) ar Subclassing validators isn't supported public API, but some users have done it, because we don't actually error entirely when it's done :/ We need to deprecate doing so first to help as many of these users ensure they can move to supported APIs, but this test ensures that in the interim, we haven't broken those users. cZeZdZejdZejdZy):ValidatorTestMixin.test_evolve_with_subclass..OhNoc gdS)Nrrrr-rrqzCValidatorTestMixin.test_evolve_with_subclass..OhNo.s)r-)factory%defaultN)rSrrTattribr_barrr-rOhNors#$''"34C4772&Dr-rr)rrrrrN)rrpr)r%rrr)r+rrrs rtest_evolve_with_subclassz,ValidatorTestMixin.test_evolve_with_subclasss  '4>> '  '$   2vy&9: ), 2&r-cGfddt}|}ddi}jtj5j ||j ddddy#1swYyxYw)zb Legacy RefResolvers support only the context manager form of resolution. c"eZdZefdZy)XValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver..LegacyRefResolverc3>Kj|dddiyw)Nthe refrrr%)thisrr+s r resolvingzbValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver..LegacyRefResolver.resolvings"  i0y))sN)rSrrTrrr*srLegacyRefResolverrs  * *r-rrrrN)rrrrr)r)r+rrrs` r*test_it_delegates_to_a_legacy_ref_resolverz=ValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolversk  * * %&)$   z99 : E NN6HN 5 > >t D E E Es #A))A2cd|j|jijddy)Nrr)rr)rr*s r#test_is_type_is_true_for_valid_typez6ValidatorTestMixin.test_is_type_is_true_for_valid_types$ r*225(CDr-cd|j|jijddy)Nrrrhr)rr*s r&test_is_type_is_false_for_invalid_typez9ValidatorTestMixin.test_is_type_is_false_for_invalid_types& +33E7CDr-c|j|jijdd|j|jijddy)NTrrr r*s r,test_is_type_evades_bool_inheriting_from_intz?ValidatorTestMixin.test_is_type_evades_bool_inheriting_from_intsJ +33D)DE +33D(CDr-cdddii}tj|j|jjj dd}||}|j ddt dt dz gd igd dg}|j|j|Dcgc]}|jc}|ycc}w) Nrrrc^t|tttfxrt|t Sr/) isinstanceintfloatrboolrrs rrqzGValidatorTestMixin.test_it_can_validate_with_decimals..s,zC0((2$UD11r-r#rAg?rzrT) rrr)r2redefinerrr%r:r)r+rr)rrrs r"test_it_can_validate_with_decimalsz5ValidatorTestMixin.test_it_can_validate_with_decimalssFH-.%% NN44==2 f% AsGAJ$;<="b$- )2)>)>w)G HU^^ H  Hs#B?c`|jddit}|jdy)Nrcarrotrbugs)r)r rr+rs r7test_it_returns_true_for_formats_it_does_not_know_aboutzJValidatorTestMixin.test_it_returns_true_for_formats_it_does_not_know_about s1NN x #  6"r-c\|ji}|j|jyr/)r)r]rrs r,test_it_does_not_validate_formats_by_defaultz?ValidatorTestMixin.test_it_does_not_validate_formats_by_defaults$NN2&  )223r-ct}td|jdtfd}jddi|}|j dj t j5}|j ddddjjjy#1swY0xYw) NzBad!r)raisesc`|dk(ry|dk(rjdj|y)NgoodTbadz What is {}? [Baby Don't Hurt Me])rr)rr%r+s rcheckzTValidatorTestMixin.test_it_validates_formats_if_a_checker_is_provided..checks1%  <CCEJKr-rrr$r%) r ValueErrorrr)rrrrrg exceptioncause)r+rr&rcmr%s` @r2test_it_validates_formats_if_a_checker_is_providedzEValidatorTestMixin.test_it_validates_formats_if_a_checker_is_provideds/  j 1 L 2 LNN u g#  6"   z99 : &b   u % & bll((#.  & &s =B>>Cct}d|gi}tj|j|jjj |d}||j dy)Nrc"t|tSr/rrrs rrqz@ValidatorTestMixin.test_non_string_custom_type..6s z%'=r-rru)rrrr)r2rr)r+non_string_typerCrazys rtest_non_string_custom_typez.ValidatorTestMixin.test_non_string_custom_type/s_ (?+,!! NN44===  f r"r-cttj|j|jjj dd}|j t j5}|ddijdddd|jdtjy#1swY/xYw) zh A tuple instance properly formats validation errors for uniqueItems. See #224 rc"t|tSr/)rtuplers rrqzNValidatorTestMixin.test_it_properly_formats_tuples_in_errors..Es z%'?r-r uniqueItemsT)rArANz(1, 1) has non-unique elements) rrr)r2rrrrrrvstrr()r+TupleValidatorrjs r)test_it_properly_formats_tuples_in_errorsz.VsJe}5r-c(t|tfSr/)rr')rrr:s rrqzBValidatorTestMixin.test_check_redefined_sequence..YsZi06r-)rrr)r[NrrlTFrr[)r[rAr[N) rrrr)r2 redefine_manyrrrrr)r+rr)rvalid_instancesrinvalid_instancesr:s @rtest_check_redefined_sequencez0ValidatorTestMixin.test_check_redefined_sequenceLsY"$7{F3 %% NN44BB    f%  , - E7QC. ! E7^UA3Z (UGn qc | ,w !" #s ~&6%7 8 E5'N# $eUA3ZL&9 : sA  #u 5 6#qc |,#ug/0  # #uaSz :;<# #ueW~ >?@ 5w( )5uaSz1B+C D! &( )H   x ( ) / " E7UG$ % E7^UE7^ ,UGn ug/ 0w !" #w(8'9&:%; < E5'N# $eUE7^,<&= > sE "Ic5$9 :#ug/0#ug/0  # #ueW~ >?@# #ueW~ >?@ 5w( )5ueW~1F+G H! &* -H"":#=#=> -""8, - - - - -s L;;M N)rSrrTrrrrrrrrrr r rrrr r+r1r8r@rr-rrrskGCDI % ,',E$EEE *# 4/0 #J"@-r-rceZdZdZdZdZejeddZ ejeddZ y)AntiDraft6LeakMixinzN Make sure functionality from draft 6 doesn't leak backwards in time. c|jtj5}|jj dddd|j dt jy#1swY/xYw)NTzTrue is not of typerrrr)rrvr6r(r+rjs rtest_True_is_not_a_schemaz-AntiDraft6LeakMixin.test_True_is_not_a_schemasW   z55 6 .! NN ' ' - . +S-=> . . A**A3c|jtj5}|jj dddd|j dt jy#1swY/xYw)NFzFalse is not of typerDrEs rtest_False_is_not_a_schemaz.AntiDraft6LeakMixin.test_False_is_not_a_schemasW   z55 6 /! NN ' ' . / ,c!++.>? / /rGi ctjdi}|jt5}|j d|j dddd|j jtjy#1swY4xYw)NrlTrr rrr Exceptionr)rassertNotIsInstancer(rrr+rrjs r5test_True_is_not_a_schema_even_if_you_forget_to_checkzIAntiDraft6LeakMixin.test_True_is_not_a_schema_even_if_you_forget_to_checksr))"b1   y ) AQ NN4(N 3 < .s j.Dr-rrrrN) rrr)r2rrrrr)r+r0rs rtest_any_type_is_redefinablez0TestDraft3Validator.test_any_type_is_redefinables!! NN44==D  65/* 2   z99 : &   u % & & &s BB%cv|j|jddijtyrZ)rr)rrr*s r!test_is_type_is_true_for_any_typez5TestDraft3Validator.test_is_type_is_true_for_any_types( 7@@JKr-c|j|jijdd|j|jddijdy)NTrrr[)rr)rrr*s r6test_is_type_does_not_evade_bool_if_it_is_being_testedzJTestDraft3Validator.test_is_type_does_not_evade_bool_if_it_is_being_testedsH r*224CD 7@@FGr-N) rSrrTrrr)r__annotations__rr\r_rarcrr-rrWrWsA**I "BxE 'y!5(G% &LHr-rWcDeZdZUejZiifZded<ddidfZy)TestDraft4ValidatorrXrrrrN) rSrrTrrr)rrdrrr-rrfrf+**I "BxE 'y!5(Gr-rfcDeZdZUejZiifZded<ddidfZy)TestDraft6ValidatorrXrrrrN) rSrrTrrr)rrdrrr-rririrgr-ricDeZdZUejZiifZded<ddidfZy)TestDraft7ValidatorrXrrrrN) rSrrTrrr)rrdrrr-rrkrkrgr-rkcDeZdZUejZiifZded<ddidfZy)TestDraft201909ValidatorrXrrrrN) rSrrTrDraft201909Validatorr)rrdrrr-rrmrm+//I "BxE 'y!5(Gr-rmcDeZdZUejZiifZded<ddidfZy)TestDraft202012ValidatorrXrrrrN) rSrrTrrr)rrdrrr-rrqrqror-rqcfeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy)TestValidatorForcddi}|jtj|tjddi}|jtj|tjy)N$schema&http://json-schema.org/draft-03/schema'http://json-schema.org/draft-03/schema#)rgr validator_forrr5s r test_draft_3zTestValidatorFor.test_draft_3`EF  $ $V ,  & & FG  $ $V ,  & & r-cddi}|jtj|tjddi}|jtj|tjy)Nru&http://json-schema.org/draft-04/schema'http://json-schema.org/draft-04/schema#)rgrrxrr5s r test_draft_4zTestValidatorFor.test_draft_4rzr-cddi}|jtj|tjddi}|jtj|tjy)Nru&http://json-schema.org/draft-06/schema'http://json-schema.org/draft-06/schema#)rgrrxrr5s r test_draft_6zTestValidatorFor.test_draft_6rzr-cddi}|jtj|tjddi}|jtj|tjy)Nru&http://json-schema.org/draft-07/schema'http://json-schema.org/draft-07/schema#)rgrrxrr5s r test_draft_7zTestValidatorFor.test_draft_7rzr-cddi}|jtj|tjddi}|jtj|tjy)Nruz,https://json-schema.org/draft/2019-09/schemaz-https://json-schema.org/draft/2019-09/schema#)rgrrxrnr5s rtest_draft_201909z"TestValidatorFor.test_draft_201909 `KL  $ $V ,  + + LM  $ $V ,  + + r-cddi}|jtj|tjddi}|jtj|tjy)Nru,https://json-schema.org/draft/2020-12/schema-https://json-schema.org/draft/2020-12/schema#)rgrrxrr5s rtest_draft_202012z"TestValidatorFor.test_draft_202012-rr-cj|jtjdtjy)NTrgrrxrr*s r test_TruezTestValidatorFor.test_True:s%  $ $T *  & & r-cj|jtjdtjyrrr*s r test_FalsezTestValidatorFor.test_False@s%  $ $U +  & & r-ctjddidd}ddi}|jtj||y)Nreri12c&|jddSrkrmros rrqz8TestValidatorFor.test_custom_validator..Jrrr-rsrurr(rgrxr+r)rs rtest_custom_validatorz&TestValidatorFor.test_custom_validatorFsK%%/0+ -.  $ $V ,  r-ctjddid}ddi}|jtj||y)Nr!r|13rOrurrs rtest_custom_validator_draft6z-TestValidatorFor.test_custom_validator_draft6RsH%% 12 ./  $ $V ,  r-cj|jtjitjyr/rr*s r%test_validator_for_jsonschema_defaultz6TestValidatorFor.test_validator_for_jsonschema_default]s! j..r2J4N4NOr-cR|jtjiddy)Nr)rgrrxr*s r!test_validator_for_custom_defaultz2TestValidatorFor.test_validator_for_custom_default`s j..r4@$Gr-c|jt5}tjddiddd|j j t |j t|jdy#1swYOxYw)Nru unknownSchemarzThe metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.) assertWarnsDeprecationWarningrrxr%filename__file__r6warning)r+r*s r1test_warns_if_meta_schema_specified_was_not_foundzBTestValidatorFor.test_warns_if_meta_schema_specified_was_not_foundcss   0 1 JR  $ $Y,H I J h/   O &  J Js A==Bctjd5}tjdtjiiddd|j y#1swYxYw)NT)recordalways)rr)warningscatch_warnings simplefilterrrxrh)r+ws r0test_does_not_warn_if_meta_schema_is_unspecifiedzATestValidatorFor.test_does_not_warn_if_meta_schema_is_unspecifiedosU  $ $D 1 TestValidatorFor.test_validator_for_custom_default_with_schemaus.$&>? j..vw?Ir-N)rSrrTryr~rrrrrrrrrrrrrrr-rrsrssP                 PH   Jr-rscHeZdZdZdZdZdZdZdZdZ dZ d Z d Z y ) TestValidatecg}tjj|d|j5t j i|ddd|j ||gy#1swYxYw)Nr)r patchrappendrrr%)r+rr)results r assertUseszTestValidate.assertUses{sX ZZ  y.&-- H ,   F + , &* , ,s A!!A*c|jdditj|jdditjy)Nrurwrr)rv)rrrr*s rtest_draft3_validator_is_chosenz,TestValidate.test_draft3_validator_is_chosenJ HI 00  GH 00  r-c|jdditj|jdditjy)Nrur}rr|)rrrr*s rtest_draft4_validator_is_chosenz,TestValidate.test_draft4_validator_is_chosenrr-c|jdditj|jdditjy)Nrurrr)rrrr*s rtest_draft6_validator_is_chosenz,TestValidate.test_draft6_validator_is_chosenrr-c|jdditj|jdditjy)Nrurrr)rrrr*s rtest_draft7_validator_is_chosenz,TestValidate.test_draft7_validator_is_chosenrr-c|jdditj|jdditjy)Nrurrrrrrr*s r$test_draft202012_validator_is_chosenz1TestValidate.test_draft202012_validator_is_chosensR J!55   I!55  r-cF|jitjy)Nrrr*s r)test_draft202012_validator_is_the_defaultz6TestValidate.test_draft202012_validator_is_the_defaults rZ-L-LMr-c|jtj5}tjdddiddd|j t jdy#1swY/xYw)Nrrrz1(?s)Failed validating '.*' in schema.*On instance)rrrrr assertRegexr6r(rEs rtest_validation_error_messagez*TestValidate.test_validation_error_messages_   z99 : 8a   VX$6 7 8    ?  8 8 A''A0c|jtj5}tjdddiddd|j t jdy#1swY/xYw)Nrrz3(?s)Failed validating '.*' in metaschema.*On schema)rrrrrrr6r(rEs rtest_schema_error_messagez&TestValidate.test_schema_error_messages^   z55 6 2!   VRL 1 2    A  2 2rcddddddigi}|jtj5}tjd|ddd|j dt jy#1swY/xYw) NrFrr[rrrrz!12 is less than the minimum of 20)rrrrrrvr6r()r+rrjs rtest_it_uses_best_matchz$TestValidate.test_it_uses_best_matchsv !b1!    z99 : ,a   F + , 93q{{;KL , ,s A00A9N) rSrrTrrrrrrrrrrrr-rrrzs6+          N   Mr-rcveZdZdZdZddiZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZy)TestRefResolverrlz foo://storedstoredrci|_|j|ji|_t j |j |j|j|_yr/)referrer stored_uri stored_schemarrrbase_urirr*s rr,zTestRefResolver.setUpsD oot'9'9: ".. MM4==$**  r-ctjjd}tjj |j d5}|j j|5} dddddd|jtjj|jjy#1swYWxYw#1swY[xYw)Nreresolve_remote) rrr1r rrrrr%rhcalled)r+rpatchedresolveds r6test_it_does_not_retrieve_schema_urls_from_the_networkzFTestRefResolver.test_it_does_not_retrieve_schema_urls_from_the_networks((44T: ZZ  t}}.> ? 7((-    :#=#=#I#IJ (    s$C$B<&C<C CCcd}dti|jd<|jj|5}|j ||jdddddy#1swYyxYw)Nz#/properties/foorrq)rrrrr%)r+rrs rtest_it_resolves_local_refsz+TestRefResolver.test_it_resolves_local_refssg ',fh&7 l# ]] $ $S ) KX   Xt}}\'B5'I J K K Ks #A##A,cBdddid}tjj|d}|jd5}|j ||dddd|jd 5}|j ||ddddy#1swY9xYw#1swYyxYw) Nzhttp://bar/schema#rr)rer[c&|jddSrkrmrs rrqzETestRefResolver.test_it_resolves_local_refs_with_id..D"!5r-rtz#/ar[zhttp://bar/schema#/a)rr from_schemarr%r+rrrs r#test_it_resolves_local_refs_with_idz3TestRefResolver.test_it_resolves_local_refs_with_ids,E5>B))55 56    & 4(   Xvc{ 3 4    6 7 48   Xvc{ 3 4 4 4 4 4 4sB *B BBcj|jj|j5}|j||jdddddi|jj d<|jjd5}|j |ddddy#1swY[xYw#1swYyxYw)Nrr cached_refzcached_ref#/foo)rrrrgrrr%)r+rs rtest_it_retrieves_stored_refsz-TestRefResolver.test_it_retrieves_stored_refss ]] $ $T__ 5 8 MM(D$6$6 7 8.3BK L) ]] $ $%6 7 +8   Xr * + +  8 8 + +sBB)B&)B2cld}ddi}dtjvr<|jtjjdtjdt d|itjd<|j j |5}|j|ddddy#1swYyxYw)Nhttp://bar#bazr+rrequests http://bar)sysmodulesr$ __setitem__ReallyFakeRequestsrrr%)r+rrrs r,test_it_retrieves_unstored_refs_via_requestsz.fake_urlopen s6   S, /$**V,33F;<  ]] $ $S ) .X   Xu - . .  - -  . .sAB>"C >C Ccddi}tjj|d}|j|jd|j|j d|j d5}|j||ddd|j d5}|j||ddd|j d5}|j||ddd|j d5}|j||dddy#1swYxYw#1swYnxYw#1swYNxYw#1swYyxYw)Nrerc&|jddSrkrmrs rrqzPTestRefResolver.test_it_can_construct_a_base_uri_from_a_schema..9rr-rrl#zfoo#rrrr%rresolution_scoperrs r.test_it_can_construct_a_base_uri_from_a_schemaz>TestRefResolver.test_it_can_construct_a_base_uri_from_a_schema5s3))55 56  **E2 22E:    # /x   Xv . /    $ /   Xv . /    & /(   Xv . /    ' /8   Xv . / /  / / / / / / / /s00DDD(4D4DD%(D14D=ci}tjj|}|j|jd|j|j d|j d5}|j||ddd|j d5}|j||dddy#1swY6xYw#1swYyxYw)Nrlr r rs r9test_it_can_construct_a_base_uri_from_a_schema_without_idzITestRefResolver.test_it_can_construct_a_base_uri_from_a_schema_without_idFs))55f= **B/ 22B7    # /x   Xv . /    $ /   Xv . / / / / / /s+B3B?3B<?Ccfd}ddidtjdid|i}|j5}j|dddy#1swYyxYw)Nc,j|Sr/r)rrrr+s rhandlerz@TestRefResolver.test_custom_uri_scheme_handlers..handlerQs   S# &Mr-rr foo://barrlhandlers)rrrr%)r+rrrrrs` @@rtest_custom_uri_scheme_handlersz/TestRefResolver.test_custom_uri_scheme_handlersPsf ))"bE7;KL    $ /   Xv . / / /s AA!ctgfd}d}tjdidd|i}|j|5 ddd|j|5 dddy#1swY%xYw#1swYyxYw)Ncf jS#t$rjdYywxYw)Nz#Response must not have been cached!rR IndexErrorrrresponser+s rrz5TestRefResolver.test_cache_remote_on..handler^s3 A||~% A ?@ A 00rrlTr cache_remoterrrrrr+rrrrs` @rtest_cache_remote_onz$TestRefResolver.test_cache_remote_on[sH: A )) 0@    $       $        sA(A4(A14A=ctgfd}d}tjdidd|i}|j|5 dddy#1swYyxYw)Ncf jS#t$rjdYywxYw)NzHandler called twice!rrs rrz6TestRefResolver.test_cache_remote_off..handlerps0 3||~% 3 12 3rrrlFrrr!r"s` @rtest_cache_remote_offz%TestRefResolver.test_cache_remote_offms^H: 3 )) %1A    $     s A  Actdfd}d}tjdid|i}|jtj 5}|j |5|jddddddd|jjt j y#1swYAxYw#1swYExYw)NzOh no! What's this?cr/r)rrs rrzTTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_error..handlersKr-rrlrrzShouldn't get this far!) r'rrrrRefResolutionErrorrrr%r()r+rrrerrrs @r3test_if_you_give_it_junk_you_get_a_resolution_errorzCTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_error}s01 ))"bE7;KL   z<< = 5##C( 5 34 5 5  (E(Ee(LM 5 5 5 5s$ B=B11B=1B: 6B==Cc"tjdi}|j|jtj 5}|jddd|j dtjy#1swY/xYw)NrlzFailed to pop the scope) rr pop_scoperrr)rvr6r()r+rexcs r.test_helpful_error_message_on_failed_pop_scopez>TestRefResolver.test_helpful_error_message_on_failed_pop_scopeso))"b1   z<< = !     ! /S]]1CD ! !s BBN)rSrrTrrrr,rrrrrrrrrrr#r&r+r/rr-rrrsdHJx(M )K 4+ +',./"/ /$ NEr-rc"d}t||S)Nc|jDcgc] }t|c}|jDcgc] }t|c}fScc}wcc}wr/)r_r6r@)rrjs rkeyzsorted_errors..keys@"ZZ (SV (".. /SV /  ( /s AA )r2)sorted)rr2s rrfrfs &c ""r-c4eZdZejZdZy)rc|jj|}|tdt|zt t j |S)Nz Unknown URL: ) _responsesrnr'rX_ReallyFakeJSONResponserr)r+rrs rrnzReallyFakeRequests.getsC??&&s+ ;_tCy89 9&tzz(';<rDsy")%#'  *1 PI(PIfzC(zCz L  L  ^8688o--vo-dJ&J<H-/A8H@)-/A8) ),h) ),h) )18) )18) LJxLJ^^M8^MBtEhtEn#===*f**r-