%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyo

�
���Xc@s�ddlZddlmZmZddlmZddlmZmZdej	fd��YZ
dej	fd��YZd	ej	fd
��YZdej	fd��YZ
dS(
i����N(tDraft4Validatort
exceptions(tPY3(tmocktunittestt
TestBestMatchcBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
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_matchtreversedtassertEqualtformat(tselfterrorstbestt
reversed_bestR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyR	scCsstiiidd6iidd6d6d6d6d6�}|j|jiigd6d6��}|j|jd�dS(Nit
minPropertiestobjectttypetbart
propertiestfoo(RRtiter_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|jd�dS(	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
Cs�tiiiidd6iiidd6d6d6gd6d6d6�}|j|jiidd6d6��}|j|jd�d	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
Cs�tiiiidd6iiidd6d6d6gd6d6d6�}|j|jiidd6d6��}|j|jd�d	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
Cs�tiiiidd6iiidd6d6d6gd6d6d6�}|j|jiidd6d6��}|j|jd�d	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Cs�tiiiidd6iidd6iiidd6d6d6gd6gd6d6d6�}|j|jiidd6d6��}|j|jd�dS(	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|ji��jd�dS(NiR(RRR
RRR(RRterror((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_one_error�s
cCs/ti�}|jtj|ji���dS(N(RtassertIsNoneRRR(RR((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_no_errors�s(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,eZd�Zd�Zd�Zd�ZRS(cCs�tjdddg�}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_matches�scCs�tjddg�}tjdddg�}t||gdtj�}|jg|D]}t|j�^qUdggg�t||gdtj�}|jg|D]}t|j�^q�dggg�dS(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_matches�scCs�tjddgdd�}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_priority�scCs�tjddgdd�}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_priority�s(R)R*R6R8R>RA(((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyR+�s				t
TestErrorTreecBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCsKgtd�D]}tj�^q
}tj|�}|j|jd�dS(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_contains�s%cCs>tjdddg�g}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_error�scCs>tjdddg�g}tj|�}|jd|�dS(Ns	a messageR,RR(RR/REtassertNotIn(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_error�scCsEtjddd�}tj|g�}|j|ji|d6�dS(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_dict�scCsntjdddg�tjddddg�g}tj|�}|jd|d�|jd|d�dS(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_path�s
cCs�tjddddddg�tjddddddg�}}tj||g�}|j|ddji|d6|d6�dS(	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_built�s%c	Csftjddddddgdd�tjd	dd
dddgdd
�}}tj||g�dS(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_instance�s
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|dtj�dS(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.pyRB�s									tTestErrorInitReprStrcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
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
cKs�tr|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.pytassertShows.scCs)|j�}|jt|j�d�dS(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*|jttjdd��dd�dS(NRcsHello!s<ValidationError: %r>(R
treprRR/(R((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt	test_repr<scCs�tjd�}|jt|�d�idd6dd6dd6idd6d6}xI|D]A}t|�}||=tjd|�}|jt|�d�qUWdS(	NRcRRRRiRWRd(RR/R
RoRe(RR%Rgtattrtk((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_unset_errorBs
cCs|jddgdg�dS(Ns�
            Failed validating u'type' in schema:
                {u'type': u'string'}

            On instance:
                5
            R,tschema_path(Rt(R((sQ/opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyttest_empty_pathsSscCs#|jdddgddg�dS(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,|jddddgddddg�dS(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|jd�WdQXdS(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|jj�dS(	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/RotassertFalset__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}RR�R�R�R�(((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.pyt<module>s�4L

Zerion Mini Shell 1.0