ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ ]c@sddlZddlmZmZddlmZddlmZmZdej fdYZ dej fdYZ d ej fd YZ d ej fd YZ dS( iN(tDraft4Validatort exceptions(tPY3(tmocktunittestt TestBestMatchcBsYeZdZdZdZdZdZdZdZdZ dZ RS( cCs\t|}tj|}tjt|}d}|j||d|j|||S(Ns:Didn't return a consistent best match! Got: {0} Then: {1}tmsg(tlistRt best_matchtreversedt assertEqualtformat(tselfterrorstbestt reversed_bestR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyR s cCsstiiidd6iidd6d6d6d6d6}|j|jiigd6d6}|j|jddS(Nit minPropertiestobjectttypetbart propertiestfoo(RRt iter_errorsR t validator(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt(test_shallower_errors_are_better_matchess#&cCsxtidd6idd6idd6gd6idd6idd6gd6}|j|ji}|j|jddS( so A property you *must* match is probably better than one you have to match a part of. iRtstringRtnumbertanyOftoneOfN(RRRR R(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt%test_oneOf_and_anyOf_are_weak_matches!s!c Cstiiiidd6iiidd6d6d6gd6d6d6}|j|jiidd6d6}|j|jdd S( sM If the most relevant error is an anyOf, then we traverse its context and select the otherwise *least* relevant error, since in this case that means the most specific, deep, error inside the instance. I.e. since only one of the schemas must match, we look for the most relevant one. RRtarrayRRRRi N(RRRR tvalidator_value(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8test_if_the_most_relevant_error_is_anyOf_it_is_traversed2s  -&c Cstiiiidd6iiidd6d6d6gd6d6d6}|j|jiidd6d6}|j|jdd S( sM If the most relevant error is an oneOf, then we traverse its context and select the otherwise *least* relevant error, since in this case that means the most specific, deep, error inside the instance. I.e. since only one of the schemas must match, we look for the most relevant one. RRRRRRRi N(RRRR R(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8test_if_the_most_relevant_error_is_oneOf_it_is_traversedLs  -&c Cstiiiidd6iiidd6d6d6gd6d6d6}|j|jiidd6d6}|j|jdd S( s Now, if the error is allOf, we traverse but select the *most* relevant error from the context, because all schemas here must match anyways. RRRRRtallOfRi N(RRRR R(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8test_if_the_most_relevant_error_is_allOf_it_is_traversedfs -&c Cstiiiidd6iidd6iiidd6d6d6gd6gd6d6d6}|j|jiidd6d6}|j|jddS( NRRRRRRRi (RRRR R(R RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_nested_context_for_oneOf|s  . &cCsNtidd6}|ji\}|jtj|jijddS(NiR(RRR RRR(R Rterror((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_one_errors cCs/ti}|jtj|jidS(N(Rt assertIsNoneRRR(R R((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_no_errorss ( t__name__t __module__RRRR R!R#R$R&R((((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyRs       tTestByRelevancecBs,eZdZdZdZdZRS(cCstjdddg}tjddddg}t||gdtj}|j||t||gdtj}|j||dS(NsOh no!tpathtbazsOh yes!RRtkey(RtValidationErrortmaxt relevancetassertIs(R tshallowtdeeptmatch((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt#test_short_paths_are_better_matchess cCstjddg}tjdddg}t||gdtj}|jg|D]}t|j^qUdgggt||gdtj}|jg|D]}t|j^qdgggdS(NsOh no!R,sOh yes!RR.(RR/tsortedR1R RR,(R R3R4R R%((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt*test_global_errors_are_even_better_matchesscCstjddgdd}tjddgdd}tjdd}t||gd|}|j||t||gd|}|j||dS( NsOh no!R,RtasOh yes!tbtweakR.(RR/t by_relevanceR0R2(R R;tnormalRR5((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt'test_weak_validators_are_lower_priorityscCstjddgdd}tjddgdd}tjddgdd}tjd dd d}t|||gd |}|j||t|||gd |}|j||dS( NsOh no!R,RR9sOh yes!R:sOh fine!tcR;tstrongR.(RR/R<R0R2(R R;R=R@RR5((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt*test_strong_validators_are_higher_prioritys(R)R*R6R8R>RA(((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyR+s  t TestErrorTreecBsYeZdZdZdZdZdZdZdZdZ dZ RS( cCsKgtdD]}tj^q }tj|}|j|jddS(Ni(trangeRt MagicMockRt ErrorTreeR t total_errors(R t_R ttree((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt/test_it_knows_how_many_total_errors_it_containss%cCs>tjdddgg}tj|}|jd|dS(Ns a messageR,R(RR/REtassertIn(R R RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt1test_it_contains_an_item_if_the_item_had_an_errorscCs>tjdddgg}tj|}|jd|dS(Ns a messageR,RR(RR/REt assertNotIn(R R RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt9test_it_does_not_contain_an_item_if_the_item_had_no_errorscCsEtjddd}tj|g}|j|ji|d6dS(Ns a messageRR(RR/RER R (R R%RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt1test_validators_that_failed_appear_in_errors_dictscCsntjdddgtjddddgg}tj|}|jd|d|jd|ddS(Ns a bar messageR,Rsa bar -> 0 messageii(RR/RERJRL(R R RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt1test_it_creates_a_child_tree_for_each_nested_paths cCstjddddddgtjddddddg}}tj||g}|j|ddji|d6|d6dS( Nt1RRR,Rit2tquux(RR/RER R (R te1te2RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt+test_children_have_their_errors_dicts_builts%c Csftjddddddgddtjd dd dd d gdd }}tj||gdS(NRPRRR,Rtbar2tinstanceti1RQRRtfoobariti2(RR/RE(R RSRT((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt-test_regression_multiple_errors_with_instances   cCsOtjddddg}tj|g}|jt |dWdQXdS(Nt123RRRWi(RR/REt assertRaisest IndexError(R R%RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt>test_it_does_not_contain_subtrees_that_are_not_in_the_instance scCsQtjddddiddg}tj|g}|j|dtjdS(s If a validator is dumb (like :validator:`required` in draft 3) and refers to a path that isn't in the instance, the tree still properly returns a subtree for that path. s a messageRRRWR,N(RR/REtassertIsInstance(R R%RH((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt9test_if_its_in_the_tree_anyhow_it_does_not_raise_an_errors( R)R*RIRKRMRNRORUR[R_Ra(((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyRBs       tTestErrorInitReprStrcBsbeZdZdZdZdZdZdZdZdZ dZ d Z RS( c KsHtddddddddd idd6}|j|tj|S( NtmessageuhelloRutypeRustringRWitschema(tdicttupdateRR/(R tkwargstdefaults((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt make_error#s cKstr|jdd}ntj|jd}|j|}t|jd\}}}|j||j |j||dS(Nsu't's ( RtreplacettextwraptdedenttrstripRitstrt partitionR Rc(R texpectedRgR%t message_lineRGtrest((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt assertShows.scCs)|j}|jt|jddS(Ni(Rit assertGreatertlentargs(R R%((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt!test_it_calls_super_and_sets_args8s cCs*|jttjdddddS(NRcsHello!s(R treprRR/(R ((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt test_repr<scCstjd}|jt|didd6dd6dd6idd6d6}xI|D]A}t|}||=tjd|}|jt|dqUWdS( NRcRRRRiRWRd(RR/R RoRe(R R%Rgtattrtk((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_unset_errorBs  cCs|jddgdgdS(Ns Failed validating u'type' in schema: {u'type': u'string'} On instance: 5 R,t schema_path(Rt(R ((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_empty_pathsSscCs#|jdddgddgdS(Ns Failed validating u'type' in schema: {u'type': u'string'} On instance[0]: 5 R,iR~titems(Rt(R ((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_one_item_paths`s cCs,|jddddgddddgdS(Ns Failed validating u'type' in schema[u'items'][0]: {u'type': u'string'} On instance[0][u'a']: 5 R,iuaR~uitemsi(Rt(R ((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_multiple_item_pathsms cCs?tjd*}t|j|j|jdWdQXdS(Nspprint.pformati(RtpatchRoRiR t call_count(R tpformat((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_uses_pprintzsc CsTtj}tjdddd|dddd}t||j|jjdS( s Check for https://github.com/Julian/jsonschema/issues/164 which rendered exceptions unusable when a `ValidationError` involved instances with an `__eq__` method that returned truthy values. s a messageRRRWRtsomeRdN(RRDRR/Rot assertFalset__eq__tcalled(R RWR%((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt:test_str_works_with_instances_having_overriden_eq_operators   ( R)R*RiRtRxRzR}RRRRR(((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyRb"s    (Rlt jsonschemaRRtjsonschema.compatRtjsonschema.tests.compatRRtTestCaseRR+RBRb(((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyts 4L