404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.116.81.161: ~ $
3

�=�X��@s�ddlmZddlmZddlZddlmZmZddlm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZGdd�de
j�ZGd	d
�d
e
j�ZGdd�de
j�ZGd
d�de
j�ZGdd�de�ZGdd�dee
j�ZGdd�dee
j�ZGdd�de
j�Zx:ejD]0Z e fdd�Z!dj e �Z"e"e!_#e$ee"e!�[!�qWGdd�de
j�Z%Gdd�de
j�Z&Gdd�de
j�Z'Gd d!�d!e�Z(Gd"d#�d#e(e
j�Z)Gd$d%�d%e(e
j�Z*d&d'�Z+dS)(�)�deque)�contextmanagerN)�
FormatChecker�ValidationError)�mock�unittest)	�RefResolutionError�UnknownType�Draft3Validator�Draft4Validator�RefResolver�create�extend�
validator_for�validatec@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestCreateAndExtendcCshddiii|_tj�|_d|ji|_dti|_t|j|j|jd�|_d|_	d|j	i|_
|j|j
�|_dS)N�
properties�smelly�dict)�meta_schema�
validatorsZ
default_types�)rrZ	MagicMockrrr�typesr
�	Validator�validator_value�schema�	validator)�self�r�%/usr/lib/python3.6/test_validators.py�setUps

zTestCreateAndExtend.setUpcCs:|j|jj|j�|j|jj|j�|j|jj|j�dS)N)�assertEqualr�
VALIDATORSr�META_SCHEMAr�
DEFAULT_TYPESr)rrrr�
test_attrsszTestCreateAndExtend.test_attrscCs|j|jj|j�dS)N)r!rr)rrrr�	test_init"szTestCreateAndExtend.test_initcCsld}g|j_|jt|jj|��g�tj�}|g|j_|jt|jj|��|g�|jj|j|j	||j
�dS)NZhello)r�return_valuer!�listr�iter_errorsr�MockZassert_called_withrr)r�instance�errorrrr�test_iter_errors%s
z$TestCreateAndExtend.test_iter_errorscCsLtjd�� }dd�|_tddidd�}WdQRX|jd�|j|jd�dS)	Nzjsonschema.validators.validatescSsdd�S)NcSs|S)Nr)�clsrrr�<lambda>5szfTestCreateAndExtend.test_if_a_version_is_provided_it_is_registered.<locals>.<lambda>.<locals>.<lambda>r)�versionrrrr/5szTTestCreateAndExtend.test_if_a_version_is_provided_it_is_registered.<locals>.<lambda>�id�z
my version)rr0ZMyVersionValidator)r�patch�side_effectr
�assert_called_once_withr!�__name__)r�	validatesrrrr�.test_if_a_version_is_provided_it_is_registered3s


zBTestCreateAndExtend.test_if_a_version_is_provided_it_is_registeredc
Cs4tjd��}tddid�WdQRX|j|j�dS)Nzjsonschema.validators.validatesr1)r)rr3r
�assertFalse�called)rr7rrr�6test_if_a_version_is_not_provided_it_is_not_registered:szJTestCreateAndExtend.test_if_a_version_is_not_provided_it_is_not_registeredcCs|t|jj�}tj�}t|jd|id�}|jd|fg�|j|j|�|jd|jj�|j|j	|jj	�|j|j
|jj
�dS)Nz	a new one)r)rrr"rr*r�updater!ZassertNotInr#r$)rr�newZExtendedrrr�test_extend?szTestCreateAndExtend.test_extendN)
r6�
__module__�__qualname__r r%r&r-r8r;r>rrrrr
src@s$eZdZdd�Zdd�Zdd�ZdS)�TestIterErrorscCsti�|_dS)N)r
r)rrrrr NszTestIterErrors.setUpcCsrddg}ddddgddd	ggd
d�}dd
�|jj||�D�}d|dfdd|dfg}|jt|�t|��dS)N���array�a�b�c�d�e�f�)�disallow�enum�minItemscss|]}|jVqdS)N)�message)�.0rIrrr�	<genexpr>Ysz2TestIterErrors.test_iter_errors.<locals>.<genexpr>z%r is disallowed for [1, 2]rLz[1, 2] is too shortz[1, 2] is not one of %rrM)rr)r!�sorted)rr+rZgotZexpectedrrrr-QszTestIterErrors.test_iter_errorscCs\ddgddd�}dddid	did
dddd
gd�d�i}t|jj||��}|jt|�d�dS)NrCrB��spam)�foo�bar�baz�quuxr�type�stringrN�
���)�maximumrM)rUrVrW)r(rr)r!�len)rr+r�errorsrrr�0test_iter_errors_multiple_failures_one_validatorasz?TestIterErrors.test_iter_errors_multiple_failures_one_validatorN)r6r?r@r r-rbrrrrrAMsrAc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �TestValidationErrorMessagesc
Os<|jdt�|jt��}t||f|�|�WdQRX|jjS)Nr.)�
setdefaultr
�assertRaisesrr�	exceptionrO)rr+r�args�kwargsrIrrr�message_forpsz'TestValidationErrorMessages.message_forcCs&|jdddid�}|j|dd�dS)NrBrYrZ)r+rz1 is not of type %r)rir!)rrOrrr�test_single_type_failurevsz4TestValidationErrorMessages.test_single_type_failurecCs(|jdddgid�}|j|dd�dS)NrBrYrZ)r+rz1 is not of type %r)rir!)rrOrrr�test_single_type_list_failurezsz9TestValidationErrorMessages.test_single_type_list_failurecCs.d}|jddt|�id�}|j|d|�dS)NrZ�objectrBrY)r+rz1 is not of type %r, %r)rZrl)rir(r!)rrrOrrr�test_multiple_type_failure~sz6TestValidationErrorMessages.test_multiple_type_failurecCs8dddigi}|jdd|gid�}|j|d|f�dS)NrY�minimumrKrB)r+rz1 is not of type %r)rir!)rrYrOrrr�&test_object_without_title_type_failure�szBTestValidationErrorMessages.test_object_without_title_type_failurecCs8d}d|dd�gi}|jd|d�}|j|d|f�dS)NZFoorYrK)�namernrB)r+rz1 is not of type %r)rir!)rrprrOrrr�"test_object_with_name_type_failure�sz>TestValidationErrorMessages.test_object_with_name_type_failurecCs"|jdddid�}|j|d�dS)NrBrnrC)r+rz1 is less than the minimum of 2)rir!)rrOrrr�test_minimum�sz(TestValidationErrorMessages.test_minimumcCs"|jdddid�}|j|d�dS)NrBr_r)r+rz"1 is greater than the maximum of 0)rir!)rrOrrr�test_maximum�sz(TestValidationErrorMessages.test_maximumcCs<d\}}d||ii}|jddi|�}|j|d||f�dS)NrVrUZdependenciesrCz%r is a dependency of %r)rVrU)rir!)rZdependZonrrOrrr�5test_dependencies_failure_has_single_element_not_list�szQTestValidationErrorMessages.test_dependencies_failure_has_single_element_not_listcCs$|jdggdd��}|jd|�dS)NrCF)�items�additionalItemsz(2 was unexpected))ri�assertIn)rrOrrr�#test_additionalItems_single_failure�sz?TestValidationErrorMessages.test_additionalItems_single_failurecCs(|jdddggdd��}|jd|�dS)NrBrCrKF)rurvz(1, 2, 3 were unexpected))rirw)rrOrrr�&test_additionalItems_multiple_failures�szBTestValidationErrorMessages.test_additionalItems_multiple_failurescCs2d}ddi}|j|di|�}|jd|f|�dS)NrU�additionalPropertiesFrCz(%r was unexpected))rirw)rZ
additionalrrOrrr�(test_additionalProperties_single_failure�szDTestValidationErrorMessages.test_additionalProperties_single_failurecCsNddi}|jtjddg�|�}|jtd�|�|jtd�|�|jd|�dS)NrzFrUrVzwere unexpected))rir�fromkeysrw�repr)rrrOrrr�+test_additionalProperties_multiple_failures�s
zGTestValidationErrorMessages.test_additionalProperties_multiple_failurescCsltfd�}tjdd�}|jd�|�ddi}|jd||d�}|jtd�|�|jtd�|�|jd|�dS)	N)ZformatsF)r'�thing�formatZbla)�format_checkerzis not a)rrr*Zchecksrirwr})rZcheckerZcheck_fnrrOrrr�#test_invalid_format_default_message�s
z?TestValidationErrorMessages.test_invalid_format_default_messagecCs�ddddiddid�d�}|jddi|td	�}|j|d
jtd�td�td���|jdd
d�|td	�}|j|djtd�td�td�td���dS)NrlFrYrZ)z^abc$z^def$)rYrz�patternProperties�zebra�{)r.z,{} does not match any of the regexes: {}, {}z^abc$z^def$i�)r��fishz.{}, {} do not match any of the regexes: {}, {}r�)rirr!r�r})rrrOrrr�1test_additionalProperties_false_patternProperties�s zMTestValidationErrorMessages.test_additionalProperties_false_patternPropertiesN)r6r?r@rirjrkrmrorqrrrsrtrxryr{r~r�r�rrrrrcosrcc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestValidationErrorDetailscCs�d}dddiddigi}t|�}t|j|��}|jt|�d�|d}|j|jd�|j|j|d�|j|j|�|j|j|�|j	|j
�|j|jtg��|j|j
tg��|j|jtg��|j|jtdg��|j|jtdg��|j|jtdg��|jt|j�d	�t|j�\}}|j|jd�|j|j|ddd�|j|j|�|j|j|dd�|j|j
|�|j|jtg��|j|jtg��|j|j
tg��|j|jtddg��|j|jtddg��|j|jtdddg��|j|j�|j|jd�|j|j|ddd�|j|j|�|j|j|dd�|j|j
|�|j|jtg��|j|j
tg��|j|jtg��|j|jtddg��|j|jtddg��|j|jtdddg��|jt|j�d�dS)
N��anyOfrn�rYrZrBrrC)rr(r)r!r`rrr+r�assertIsNone�parent�pathr�
relative_path�
absolute_path�schema_path�relative_schema_path�absolute_schema_path�context�
sorted_errors�assertIsr9)rr+rrrarI�e1�e2rrr�
test_anyOf�s\z%TestValidationErrorDetails.test_anyOfcCs�ddi}dddiddddgiid�gi}t|�}t|j|��}|jt|�d�|d	}|j|jd�|j|j|d�|j|j|�|j|j|�|j	|j
�|j|jtg��|j|j
tg��|j|jtg��|j|jtdg��|j|jtdg��|j|jtdg��|jt|j�d�t|j�\}}|j|jd�|j|j|dd	d�|j|j|�|j|j|dd	�|j|j
|�|j|jtg��|j|j
tg��|j|jtg��|j|jtd	dg��|j|jtd	dg��|j|jtdd	dg��|j|j�|j|jd�|j|jdg�|j|jd�|j|jddgi�|j|j
|�|j|jtdg��|j|j
tdg��|j|jtdg��|j|jtdd
ddg��|j|jtdd
ddg��|j|jtddd
ddg��|j|j�dS)NrUrBrY�integerrlrMrC)rYrrr)r
r(r)r!r`rrr+rr�r�r�rr�r�r�r�r�r�r�r�r9)rr+rrrarIr�r�rrr�	test_type sdz$TestValidationErrorDetails.test_typec	Cs�ddgddd�}dddid	did
dddd
gd�d�i}t|�}|j|�}t|�\}}}}|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jtdg��|j|jd	�|j|jd�|j|jd�|j|jd�dS)NrCrBrSrT)rUrVrWrXrrYrZrNr[r\r]r^)r_rM)rUrVrWrVrWrUrMr_)	r
r)r�r!r�rr�r�r)	rr+rrrar�r��e3�e4rrr�test_single_nestingjs0
z.TestValidationErrorDetails.test_single_nestingcCs�ddddgid�dg}dddgddd	gid
ddid
did�d�d�d�d�}t|�}|j|�}t|�\}}}}}	}
|j|jtg��|j|jtdg��|j|jtddg��|j|jtdddg��|j|	jtdddg��|j|
jtddg��|j|jtdg��|j|jtddg��|jt|j�ddddg�|jt|j�ddddddg�|jt|	j�dddddd
g�|jt|
j�ddddg�|j|jd�|j|jd�|j|jd�|j|jd�|j|	jd
�|j|
jd�dS)NrBrCrW)rUrVrXrZrlrMrKrD�requiredTrN)rVrW)rYr)rYrurrVrUrYrur)	r
r)r�r!r�rr�r(r)rr+rrrar�r�r�r�Ze5Ze6rrr�test_multiple_nesting�sD

z0TestValidationErrorDetails.test_multiple_nestingcCsBdddddgddiddd	d
iid�d�d
�giiddgdd	d
iid�}dddddddiid�id�i}t|�}|j|�\}|j|jtdg��|j|jtdddg��|j\}|j|jtdddg��|j|jtdddddddddg	��|j\}|j|jtdddddg��|j|jtdddddddddddddddg��dS)NZnoder�rlrp�childrenrYrZz^.*$z$refz#/definitions/node)rYr�)rpr�)rYr�r�root)ZdefinitionsrYr�rrEZabrrr�)rr)r!r�rr�r�)rrr+rrIr�r�rrr�test_recursive�sp
z)TestValidationErrorDetails.test_recursivecCs~ddd�}dddd�i}t|�}|j|�}t|�\}}|j|jtdg��|j|jtdg��|j|jd	�|j|jd
�dS)NrVrC)rVrUrzr�r�)rYrnrUrYrn)r
r)r�r!r�rr)rr+rrrar�r�rrr�test_additionalProperties$s

z4TestValidationErrorDetails.test_additionalPropertiescCs�ddd�}dddiddid�i}t|�}|j|�}t|�\}}|j|jtd	g��|j|jtd
g��|j|jd�|j|jd�dS)NrBrC)rVrUr�rYrZrnr�rVrU)r
r)r�r!r�rr)rr+rrrar�r�rrr�test_patternProperties2s

z1TestValidationErrorDetails.test_patternPropertiescCs~ddg}gddd�d�}t|�}|j|�}t|�\}}|j|jtdg��|j|jtdg��|j|jd�|j|jd	�dS)
NrUrBr�r�)rYrn)rurvrrYrn)r
r)r�r!r�rr)rr+rrrar�r�rrr�test_additionalItemsEs
z/TestValidationErrorDetails.test_additionalItemscCs�dddg}igddd�d�}t|�}|j|�}t|�\}}|j|jtdg��|j|jtdg��|j|jd	�|j|jd
�dS)NrUrVrBr�r�)rYrn)rurvrCrYrn)r
r)r�r!r�rr)rr+rrrar�r�rrr�test_additionalItems_with_itemsVs

z:TestValidationErrorDetails.test_additionalItems_with_itemsN)r6r?r@r�r�r�r�r�r�r�r�r�rrrrr��sBJ"6br�c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�ValidatorTestMixincCs,tj�|_i|_tj�|_|j|j�|_dS)N)rr*r+r�resolver�validator_classr)rrrrr is

zValidatorTestMixin.setUpcCsDtg�}tjj|jd|d��|j|jj|j|j��WdQRXdS)Nr))r')	�iterrr3rlr�
assertTrue�is_validr+r)rrarrr�test_valid_instances_are_validos
z1ValidatorTestMixin.test_valid_instances_are_validcCsJttj�g�}tjj|jd|d��|j|jj|j|j	��WdQRXdS)Nr))r')
r�rr*r3rlrr9r�r+r)rrarrr�$test_invalid_instances_are_not_validys
z7ValidatorTestMixin.test_invalid_instances_are_not_validcCs0tj�tj�tj�}}}t|||id�dS)N)r+r)rr*r)rr+Zmy_propertyZmy_valuerrr�(test_non_existent_properties_are_ignored�sz;ValidatorTestMixin.test_non_existent_properties_are_ignoredcCs|j|jjt�dS)N)ZassertIsInstancerr�r)rrrr�.test_it_creates_a_ref_resolver_if_not_provided�szAValidatorTestMixin.test_it_creates_a_ref_resolver_if_not_providedcCsztdi�}dtj�i}tjj|d��>}dddif|_|jt��|j||d�j	d�WdQRXWdQRX|j
|d�dS)Nr2z$ref�resolveZurlrYr�)r�)rrr*r3rlr'rerr�rr5)rr�rr�rrr�#test_it_delegates_to_a_ref_resolver�s
(z6ValidatorTestMixin.test_it_delegates_to_a_ref_resolvercsPG�fdd�dt�}|�}ddi}�jt���j||d�jd�WdQRXdS)zc
        Legacy RefResolvers support only the context manager form of
        resolution.

        cseZdZe�fdd��ZdS)zXValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolverc3s�j|d�ddiVdS)Nzthe refrYr�)r!)�this�ref)rrr�	resolving�szbValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolver.resolvingN)r6r?r@rr�r)rrr�LegacyRefResolver�sr�z$refzthe ref)r�N)rlrerr�r)rr�r�rr)rr�*test_it_delegates_to_a_legacy_ref_resolver�s
z=ValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolvercCs|j|jjdd��dS)NrUrZ)r�r�is_type)rrrr�#test_is_type_is_true_for_valid_type�sz6ValidatorTestMixin.test_is_type_is_true_for_valid_typecCs|j|jjdd��dS)NrUrD)r9rr�)rrrr�&test_is_type_is_false_for_invalid_type�sz9ValidatorTestMixin.test_is_type_is_false_for_invalid_typecCs,|j|jjdd��|j|jjdd��dS)NTr�Znumber)r9rr�)rrrr�,test_is_type_evades_bool_inheriting_from_int�sz?ValidatorTestMixin.test_is_type_evades_bool_inheriting_from_intc
Cs*|jt��|jjdt��WdQRXdS)NrU)rer	rr�rl)rrrr�.test_is_type_raises_exception_for_unknown_type�szAValidatorTestMixin.test_is_type_raises_exception_for_unknown_typeN)r6r?r@r r�r�r�r�r�r�r�r�r�r�rrrrr�hs

r�c@s(eZdZeZdd�Zdd�Zdd�ZdS)�TestDraft3ValidatorcCs |j|jjtj�ddi��dS)NrY�any)r�rr�rr*)rrrr�!test_is_type_is_true_for_any_type�sz5TestDraft3Validator.test_is_type_is_true_for_any_typecCs0|j|jjdd��|j|jjdddi��dS)NTZbooleanrYr�)r�rr�r�)rrrr�6test_is_type_does_not_evade_bool_if_it_is_being_tested�szJTestDraft3Validator.test_is_type_does_not_evade_bool_if_it_is_being_testedcCs0ddgi}|j|dtd�id�}|jd|�dS)NrY)r)r�rYr)rrr.rrr�test_non_string_custom_types�s
z0TestDraft3Validator.test_non_string_custom_typesN)r6r?r@r
r�r�r�r�rrrrr��sr�c@seZdZeZdS)�TestDraft4ValidatorN)r6r?r@rr�rrrrr��sr�c@seZdZdZdS)�TestBuiltinFormatsz�
    The built-in (specification-defined) formats do not raise type errors.

    If an instance or value is not a string, it should be ignored.

    N)r6r?r@�__doc__rrrrr��sr�cCs td|it�d�}|jd�dS)Nr�)r�r�)rrr)rr��vrrr�test�sr�ztest_{0}_ignores_non_stringsc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestValidatorForcCs4ddi}|jt|�t�ddi}|jt|�t�dS)Nz$schemaz&http://json-schema.org/draft-03/schemaz'http://json-schema.org/draft-03/schema#)r�rr
)rrrrr�test_draft_3�szTestValidatorFor.test_draft_3cCs4ddi}|jt|�t�ddi}|jt|�t�dS)Nz$schemaz&http://json-schema.org/draft-04/schemaz'http://json-schema.org/draft-04/schema#)r�rr)rrrrr�test_draft_4�szTestValidatorFor.test_draft_4cCs,tddidd�}ddi}|jt|�|�dS)Nr1zmeta schema idZ12)rr0z$schema)r
r�r)rrrrrr�test_custom_validator�sz&TestValidatorFor.test_custom_validatorcCs|jti�t�dS)N)r�rr)rrrr�%test_validator_for_jsonschema_default�sz6TestValidatorFor.test_validator_for_jsonschema_defaultcCs|jtidd�d�dS)N)�default)r�r)rrrr�!test_validator_for_custom_default�sz2TestValidatorFor.test_validator_for_custom_defaultN)r6r?r@r�r�r�r�r�rrrrr��s
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestValidatecCspddi}tjjtd��}ti|�|j|�WdQRXddi}tjjtd��}ti|�|j|�WdQRXdS)Nz$schemaz'http://json-schema.org/draft-03/schema#�check_schemaz&http://json-schema.org/draft-03/schema)rr3rlr
rr5)rr�
chk_schemarrr�test_draft3_validator_is_chosen�s

z,TestValidate.test_draft3_validator_is_chosenc
Cs:ddi}tjjtd��}ti|�|j|�WdQRXdS)Nz$schemaz'http://json-schema.org/draft-04/schema#r�)rr3rlrrr5)rrr�rrr�test_draft4_validator_is_chosens
z,TestValidate.test_draft4_validator_is_chosenc
Cs2tjjtd��}tii�|ji�WdQRXdS)Nr�)rr3rlrrr5)rr�rrr�$test_draft4_validator_is_the_defaults
z1TestValidate.test_draft4_validator_is_the_defaultN)r6r?r@r�r�r�rrrrr��sr�c@s�eZdZdZdZddiZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)"�TestRefResolverr2zfoo://storedZstoredrcCs,i|_|j|ji|_t|j|j|j�|_dS)N)�referrer�
stored_uri�
stored_schema�storer�base_urir�)rrrrr szTestRefResolver.setUpcCs\tjd}tjj|jd��,}|jj|��}|j|tj�WdQRXWdQRX|j|j	�dS)Nr1Zresolve_remote)
r
r#rr3rlr�r�r!r9r:)rr�Zremote�resolvedrrr�6test_it_does_not_retrieve_schema_urls_from_the_networks

"zFTestRefResolver.test_it_does_not_retrieve_schema_urls_from_the_networkcCsFd}dt�i|jd<|jj|��}|j||jdd�WdQRXdS)Nz#/properties/foorUr)rlr�r�r�r!)rr�r�rrr�test_it_resolves_local_refs$sz+TestRefResolver.test_it_resolves_local_refscCshdddid�}tj|�}|jd��}|j||d�WdQRX|jd��}|j||d�WdQRXdS)Nzhttp://bar/schema#rUrV)r1rEz#/arEzhttp://bar/schema#/a)r�from_schemar�r!)rrr�r�rrr�#test_it_resolves_local_refs_with_id*s
z3TestRefResolver.test_it_resolves_local_refs_with_idcCs`|jj|j��}|j||j�WdQRXddi|jjd<|jjd��}|j|d�WdQRXdS)NrUrZ
cached_refzcached_ref#/foo)r�r�r�r�r�r�r!)rr�rrr�test_it_retrieves_stored_refs2s
z-TestRefResolver.test_it_retrieves_stored_refscCsbd}ddi}tjd��6}||jjj_|jj|��}|j|d�WdQRXWdQRX|jjd�dS)Nzhttp://bar#bazrWrzjsonschema.validators.requestsz
http://bar)	rr3�getr'�jsonr�r�r!r5)rr�rZrequestsr�rrr�,test_it_retrieves_unstored_refs_via_requests:s z<TestRefResolver.test_it_retrieves_unstored_refs_via_requestscCs�d}ddi}tjdd��Vtjd��@}tj|�jd�|jj_|jj|��}|j	|d�WdQRXWdQRXWdQRX|j
d�dS)Nzhttp://bar#bazrWrzjsonschema.validators.requestszjsonschema.validators.urlopen�utf8z
http://bar)rr3r��dumps�encoder'�readr�r�r!r5)rr�rZurlopenr�rrr�+test_it_retrieves_unstored_refs_via_urlopenDs*z;TestRefResolver.test_it_retrieves_unstored_refs_via_urlopencCs�ddi}tj|�}|j|jd�|j|jd�|jd��}|j||�WdQRX|jd��}|j||�WdQRX|jd��}|j||�WdQRX|jd��}|j||�WdQRXdS)Nr1rUr2�#zfoo#)rr�r!r��resolution_scoper�)rrr�r�rrr�.test_it_can_construct_a_base_uri_from_a_schemaPs
z>TestRefResolver.test_it_can_construct_a_base_uri_from_a_schemacCsri}tj|�}|j|jd�|j|jd�|jd��}|j||�WdQRX|jd��}|j||�WdQRXdS)Nr2r�)rr�r!r�r�r�)rrr�r�rrr�9test_it_can_construct_a_base_uri_from_a_schema_without_id^s
zITestRefResolver.test_it_can_construct_a_base_uri_from_a_schema_without_idc
CsZddi}d}tj|d�}tdid|id�}|j|��}|j||�WdQRX|j|�dS)NrUrVz	foo://bar)r'r2)�handlers)rr*rr�r!r5)rrr��foo_handlerr�r�rrr�test_custom_uri_scheme_handlershsz/TestRefResolver.test_custom_uri_scheme_handlerscCsZd}tj�}tdidd|id�}|j|��WdQRX|j|��WdQRX|j|�dS)Nz	foo://barr2TrU)�cache_remoter�)rr*rr�r5)rr�r�r�rrr�test_cache_remote_onqs

z$TestRefResolver.test_cache_remote_onc
CsHd}tj�}tdidd|id�}|j|��WdQRX|j|jd�dS)Nz	foo://barr2FrU)r�r�rB)rr*rr�r!Z
call_count)rr�r�r�rrr�test_cache_remote_off}s
z%TestRefResolver.test_cache_remote_offcCshd}tjtd�d�}tdid|id�}|jt��}|j|��WdQRXWdQRX|jt|j	�d�dS)Nz	foo://barzOh no! What's this?)r4r2rU)r�)
rr*�
ValueErrorrrerr�r!�strrf)rr�r�r��errrrr�3test_if_you_give_it_junk_you_get_a_resolution_error�szCTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_errorcCsFtdi�}|j�|jt��}|j�WdQRX|jdt|j��dS)Nr2zFailed to pop the scope)rZ	pop_scopererrwr�rf)rr��excrrr�.test_helpful_error_message_on_failed_pop_scope�s

z>TestRefResolver.test_helpful_error_message_on_failed_pop_scopeN)r6r?r@r�r�r�r r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s"

	
	r�c@seZdZdZdd�ZdS)�UniqueTupleItemsMixinz�
    A tuple instance properly formats validation errors for uniqueItems.

    See https://github.com/Julian/jsonschema/pull/224

    cCsN|jddidtfid�}|jt��}|jd�WdQRX|jdt|j��dS)NZuniqueItemsTrD)rrrBz(1, 1) has non-unique elements)rBrB)r��tuplererrrwr�rf)rrrIrrr�)test_it_properly_formats_an_error_message�sz?UniqueTupleItemsMixin.test_it_properly_formats_an_error_messageN)r6r?r@r�r�rrrrr��sr�c@seZdZeZdS)�TestDraft4UniqueTupleItemsN)r6r?r@rr�rrrrr��sr�c@seZdZeZdS)�TestDraft3UniqueTupleItemsN)r6r?r@r
r�rrrrr��sr�cCsdd�}t||d�S)NcSs dd�|jD�dd�|jD�fS)NcSsg|]}t|��qSr)r�)rPrIrrr�
<listcomp>�sz.sorted_errors.<locals>.key.<locals>.<listcomp>cSsg|]}t|��qSr)r�)rPrIrrrr��s)r�r�)r,rrr�key�szsorted_errors.<locals>.key)r�)rR)rar�rrrr��sr�),�collectionsr�
contextlibrr�Z
jsonschemarrZjsonschema.tests.compatrrZjsonschema.validatorsrr	r
rrr
rrrZTestCaserrArcr�rlr�r�r�r�Zcheckersr�r�rpr6�setattrr�r�r�r�r�r�r�rrrr�<module>s<,@"lO	


Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
compat.cpython-36.opt-1.pyc File 305 B 0644
compat.cpython-36.pyc File 305 B 0644
test_cli.cpython-36.opt-1.pyc File 4.31 KB 0644
test_cli.cpython-36.pyc File 4.31 KB 0644
test_exceptions.cpython-36.opt-1.pyc File 13.37 KB 0644
test_exceptions.cpython-36.pyc File 13.37 KB 0644
test_format.cpython-36.opt-1.pyc File 2.74 KB 0644
test_format.cpython-36.pyc File 2.74 KB 0644
test_jsonschema_test_suite.cpython-36.opt-1.pyc File 9.67 KB 0644
test_jsonschema_test_suite.cpython-36.pyc File 9.71 KB 0644
test_validators.cpython-36.opt-1.pyc File 31.29 KB 0644
test_validators.cpython-36.pyc File 31.29 KB 0644