name : test_validators.cpython-39.pyc
a

ki�]���@s�ddlmZddlmZddlmZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlZddlmZmZmZmZdd	lmZmZdd
lmZdd�ZGd
d�de�ZGdd�de�ZGdd�de	�ZGdd�de	�ZGdd�de	�Z Gdd�de!�Z"Gdd�de"e!�Z#Gdd�de!�Z$Gdd�de$e#e	�Z%Gdd �d e$e#e	�Z&Gd!d"�d"e#e	�Z'Gd#d$�d$e#e	�Z(Gd%d&�d&e�Z)Gd'd(�d(e�Z*Gd)d*�d*e�Z+d+d,�Z,ej-Gd-d.�d.e!��Z.ej-Gd/d0�d0e!��Z/dS)1�)�deque)�contextmanager)�Decimal)�BytesIO)�TestCaseN)�SynchronousTestCase)�
FormatChecker�TypeChecker�
exceptions�
validators)�PY3�pathname2url)�bugccs|�|�st�d�VdS)N�Whoops!)�
startswithr
�ValidationError)�	validatorr�instance�schema�r�D/usr/lib/python3.9/site-packages/jsonschema/tests/test_validators.pyrs
rc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestCreateAndExtendcCsP|�|jtjttj��ddi|_dti|_t�|_tj	|j|j|jd�|_
dS)N�$idzsome://meta/schemar��meta_schemar�type_checker)�
addCleanup�assertEqualr�meta_schemas�dictrrr	r�create�	Validator��selfrrr�setUps�

�zTestCreateAndExtend.setUpcCs.|�|jj|jj|jjf|j|j|jf�dS�N)rr!�
VALIDATORS�META_SCHEMA�TYPE_CHECKERrrrr"rrr�
test_attrs*s���zTestCreateAndExtend.test_attrscCs ddi}|�|�|�j|�dS)Nr�foo)rr!r�r#rrrr�	test_init7szTestCreateAndExtend.test_initcCs�ddi}|�|�j}t|d��}|�|g�tjdd|ddtdg�d�}t|d��}|�t|�d�|�|d��|���dS)	NrZhelZhellorZgoodbye)rrr�validator_value�schema_path�r)	r!�iter_errors�listrr
rr�lenZ	_contents)r#rr0�errorsZexpected_errorrrr�test_iter_errors;s�	z$TestCreateAndExtend.test_iter_errorscCs4tjddidd�}|�tjjd�|�|jd�dS)Nr�	something�
my version�r�versionZMyVersionValidator)rr rr�popr�__name__�r#r!rrr�.test_if_a_version_is_provided_it_is_registeredOs�zBTestCreateAndExtend.test_if_a_version_is_provided_it_is_registeredcCs,ttj�}tjddid�|�tj|�dS)N�id)r)rrrr r)r#�originalrrr�6test_if_a_version_is_not_provided_it_is_not_registeredWs
zJTestCreateAndExtend.test_if_a_version_is_not_provided_it_is_not_registeredcCsBd}d|i}tj|ddd�d�|�tjj|�|�|tj�dS)N�meta schema idr=r6cSs|�dd�S�Nr=���get��srrr�<lambda>c�zMTestCreateAndExtend.test_validates_registers_meta_schema_id.<locals>.<lambda>�rr8�id_of�rr rrr9�assertIn�r#Zmeta_schema_keyZmy_meta_schemarrr�'test_validates_registers_meta_schema_id\s�z;TestCreateAndExtend.test_validates_registers_meta_schema_idcCs<d}d|i}tj|dd�|�tjj|�|�|tj�dS)N�meta schema $idrr6r7rKrMrrr�.test_validates_registers_meta_schema_draft6_idis�zBTestCreateAndExtend.test_validates_registers_meta_schema_draft6_idcsDtjidd��|�t�fdd�dgfdddd	d
ifdfD���dS)Nr�rrc3s$|]\}}�i�j||d�VqdS))r�typeN)�is_type)�.0rRr�r!rr�	<genexpr>xs�[email protected]_create_default_types.<locals>.<genexpr>�array)�booleanT)�integer�)�nullN)�numberg(@�object)�stringr*)rr �
assertTrue�allr"rrUr�test_create_default_typesus���z-TestCreateAndExtend.test_create_default_typescCs`t|jj�}t�}tj|jd|id�}|�|j|j|j|jjft||d�|jj|jj|f�dS)N�new�r�rb)	rr!r&r]r�extendrr'r()r#r>rb�Extendedrrr�test_extend�s$��
��zTestCreateAndExtend.test_extendcsf�fdd�}d}d|d�}tj|�j�j|d�}��|�|j�|�t�|�}��|�|j�|�dS)zK
        Extending a validator preserves its notion of schema IDs.
        cs|�d�j�|��S)N�__test__)rDr!�ID_OF�rr"rrrJ�sz3TestCreateAndExtend.test_extend_idof.<locals>.id_ofzthe://correct/id/zthe://wrong/id/)rrh)rrrrJN)rr rrrir're)r#rJZ
correct_idrZOriginalZDerivedrr"r�test_extend_idof�s��
z$TestCreateAndExtend.test_extend_idofN)r:�
__module__�__qualname__r$r)r,r4r<r?rNrPrargrkrrrrrs

rc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TestLegacyTypeCheckingcCs0tjidd�}|�t|j�hd��|��dS)NrrQ>rXr[rWrYr\r]r^)rr r�set�
DEFAULT_TYPES�
flushWarningsr;rrrra�s
�
z0TestLegacyTypeChecking.test_create_default_typescCs�tjidd�}t|j�}t�}tj|d|id�}|�|j|j|j|j|j	|i�j	|�
�ddft||d�|j|j||j	|j	|�
�ddf�dS)NrrQrbrcr�messagerd)rr rr&r]rerr'r(rprq)r#r!r>rbrfrrrrg�s2
��

��z"TestLegacyTypeChecking.test_extendcCsPddi}|�t�|��d��tj|dttfid�}|�|�d��|��dS)NrRr^rZ)�types)�assertFalser�Draft7Validator�is_valid�str�intr_rq)r#rrrrr�0test_types_redefines_the_validators_type_checker�s
�zGTestLegacyTypeChecking.test_types_redefines_the_validators_type_checkerc	Cs.|jtdtj|jjjtjiidtid�dS)NzPThe default_types argument is deprecated. Use the type_checker argument instead.r*)�categoryrr�filename�frr�
default_types)	�assertWarns�DeprecationWarning�sys�modulesrl�__file__rr r]r"rrr�"test_providing_default_types_warns�s�z9TestLegacyTypeChecking.test_providing_default_types_warnscCs�tjiit�d�}|�tj��}|jWd�n1s:0Y|�dt|j��|�tj��|i�jWd�n1s�0Y|�	|�
��dS)a�
        We raise an error when you ask a validator with non-default
        type checker for its DEFAULT_TYPES.

        The type checker argument is new, so no one but this library
        itself should be trying to use it, and doing so while then
        asking for DEFAULT_TYPES makes no sense (not to mention is
        deprecated), since type checkers are not strictly about Python
        type.
        rNz=DEFAULT_TYPES cannot be used on Validators using TypeCheckers)rr r	�assertRaisesZ_DontDoThatrprLrw�	exceptionrtrq�r#r!�errr�?test_cannot_ask_for_default_types_with_non_default_type_checker�s�$�(zVTestLegacyTypeChecking.test_cannot_ask_for_default_types_with_non_default_type_checkercCs:tjiit�d�}|�|���|i�|�|���dS)Nr)rr r	rtrqr;rrr�2test_providing_explicit_type_checker_does_not_warns�zITestLegacyTypeChecking.test_providing_explicit_type_checker_does_not_warncCs6tjiid�}|�|���|i�|�|���dS)NrQ)rr rtrqr;rrr�$test_providing_neither_does_not_warn#sz;TestLegacyTypeChecking.test_providing_neither_does_not_warncCsf|�t��(}tjiidtit�d�Wd�n1s80Y|�dt|j��|�	|�
��dS)Nr*)rrr}rz:Do not specify default_types when providing a type checker)r��	TypeErrorrr r]r	rLrwr�rtrq�r#r�rrr�5test_providing_default_types_with_type_checker_errors*s�$�zLTestLegacyTypeChecking.test_providing_default_types_with_type_checker_errorscCsntjiidtid�}|�t��"}tj|it�d�Wd�n1sF0Y|�dt|j	��|�
�dS)NrW)rrr})rrz�Cannot extend a validator created with default_types with a type_checker. Update the validator to use a type_checker when created.)rr r1r�r�rer	rLrwr�rqr�rrr�<test_extending_a_legacy_validator_with_a_type_checker_errors9s ��$�zSTestLegacyTypeChecking.test_extending_a_legacy_validator_with_a_type_checker_errorscCs8tjiid�}|�|���t�|�|�|���dS)N)rr})rr r_rqrertr;rrr�1test_extending_a_legacy_validator_does_not_rewarnPs
zHTestLegacyTypeChecking.test_extending_a_legacy_validator_does_not_rewarncCs@tjiid�}|�|���|�tdtj|jjj	t
|d�dS�NrQzcThe DEFAULT_TYPES attribute is deprecated. See the type checker attached to this validator instead.rp�rr rtrqr~rr�r�rlr��getattrr;rrr�"test_accessing_default_types_warnsWs�z9TestLegacyTypeChecking.test_accessing_default_types_warnscCsDtjiid�}|�|���|�tdtj|jjj	t
|i�d�dSr�r�r;rrr�2test_accessing_default_types_on_the_instance_warnsis�zITestLegacyTypeChecking.test_accessing_default_types_on_the_instance_warnscCsFtjiid�}|�|���|jtdtj|jjj	|idt
id�dS)NrQzaThe types argument is deprecated. Provide a type_checker to jsonschema.validators.extend instead.�bar)rzrrr{r|rrs)rr rtrqr~rr�r�rlr�r]r;rrr�"test_providing_types_to_init_warns{s�z9TestLegacyTypeChecking.test_providing_types_to_init_warnsN)r:rlrmrargryr�r�r�r�r�r�r�r�r�r�rrrrrn�srnc@s$eZdZdd�Zdd�Zdd�ZdS)�TestIterErrorscCst�i�|_dSr%)r�Draft3Validatorrr"rrrr$�szTestIterErrors.setUpcCsnddg}dgd�gd�gdd�}dd	�|j�||�D�}d
|dfdd
|dfg}|�t|�t|��dS)Nr/�rW)�a�b�c)�dr�r|�)�disallow�enum�minItemscss|]}|jVqdSr%)rr�rTr�rrrrV�rHz2TestIterErrors.test_iter_errors.<locals>.<genexpr>z%r is disallowed for [1, 2]r�z[1, 2] is too shortz[1, 2] is not one of %rr�)rr0r�sorted)r#rrZgotZexpectedrrrr4�s��zTestIterErrors.test_iter_errorscCsXddgddd�}dddid	did
gd�d�d
�i}t|j�||��}|�t|�d�dS)Nr�r/��spam�r*r��baz�quux�
propertiesrRr^r��
�r������maximumr��r*r�r�r�)r1rr0rr2)r#rrr3rrr�0test_iter_errors_multiple_failures_one_validator�s��z?TestIterErrors.test_iter_errors_multiple_failures_one_validatorN)r:rlrmr$r4r�rrrrr��sr�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�TestValidationErrorMessagescOs\|�dtj�|�tj��*}tj||g|�Ri|��Wd�n1sJ0Y|jjS)N�cls)	�
setdefaultrr�r�r
r�validater�rr)r#rr�args�kwargsr�rrr�message_for�s8z'TestValidationErrorMessages.message_forcCs&|jdddid�}|�|dd�dS�Nr/rRr^�rrz1 is not of type %r�r�r�r#rrrrr�test_single_type_failure�sz4TestValidationErrorMessages.test_single_type_failurecCs(|jdddgid�}|�|dd�dSr�r�r�rrr�test_single_type_list_failure�sz9TestValidationErrorMessages.test_single_type_list_failurecCs.d}|jddt|�id�}|�|d|�dS)N)r^r]r/rRr�z1 is not of type %r, %r)r�r1r)r#rsrrrrr�test_multiple_type_failure�sz6TestValidationErrorMessages.test_multiple_type_failurecCs2dddigi}|jdd|gid�}|�|d�dS)NrR�minimumr�r/r��1 is less than the minimum of 3r�)r#rRrrrrr�&test_object_without_title_type_failure�szBTestValidationErrorMessages.test_object_without_title_type_failurecCs.dddd�gi}|jd|d�}|�|d�dS)NrRZFoor�)�namer�r/r�r�r��r#rrrrrr�#test_object_with_named_type_failure�sz?TestValidationErrorMessages.test_object_with_named_type_failurecCs"|jdddid�}|�|d�dS)Nr/r�r�r�z1 is less than the minimum of 2r�r�rrr�test_minimum�sz(TestValidationErrorMessages.test_minimumcCs"|jdddid�}|�|d�dS)Nr/r�rr�z"1 is greater than the maximum of 0r�r�rrr�test_maximum�sz(TestValidationErrorMessages.test_maximumcCsBd\}}d||ii}|jddi|tjd�}|�|d||f�dS�N�r�r*Zdependenciesr�r��rrr�z%r is a dependency of %r�r�rr�r�r#ZdependZonrrrrrr� test_dependencies_single_element�s�z<TestValidationErrorMessages.test_dependencies_single_elementcCsDd\}}d||gii}|jddi|tjd�}|�|d||f�dSr�r�r�rrr�test_dependencies_list_draft3�s�z9TestValidationErrorMessages.test_dependencies_list_draft3cCsDd\}}d||gii}|jddi|tjd�}|�|d||f�dSr�)r�rrurr�rrr�test_dependencies_list_draft7�s�z9TestValidationErrorMessages.test_dependencies_list_draft7cCs&|jdggdd�d�}|�d|�dS)Nr�F��itemsZadditionalItemsr�z(2 was unexpected)�r�rLr�rrr�#test_additionalItems_single_failure�s
�z?TestValidationErrorMessages.test_additionalItems_single_failurecCs(|jgd�gdd�d�}|�d|�dS)N)r/r�r�Fr�r�z(1, 2, 3 were unexpected)r�r�rrr�&test_additionalItems_multiple_failures�s
�zBTestValidationErrorMessages.test_additionalItems_multiple_failurescCs4d}ddi}|j|di|d�}|�d|f|�dS)Nr*�additionalPropertiesFr�r�z(%r was unexpected)r�)r#�
additionalrrrrrr�(test_additionalProperties_single_failureszDTestValidationErrorMessages.test_additionalProperties_single_failurecCsPddi}|jt�ddg�|d�}|�td�|�|�td�|�|�d|�dS)Nr�Fr*r�r�zwere unexpected))r�r�fromkeysrL�reprr�rrr�+test_additionalProperties_multiple_failures	s�zGTestValidationErrorMessages.test_additionalProperties_multiple_failurescCs.ddi}|jddi|tjd�}|�d|�dS)N�constrZr*r�r�z12 was expected�r�r�Draft6ValidatorrLr�rrr�
test_consts�z&TestValidationErrorMessages.test_constcCs4dddii}|jdigg|tjd�}|�d|�dS)N�containsr�rZr�r�z4None of [2, {}, []] are valid under the given schemar�r�rrr�
test_containss��z)TestValidationErrorMessages.test_containscCsdtdd�}|�d�dd��ddi}|jd||d�}|�td�|�|�td�|�|�d	|�dS)
Nr)�formats�thingcSsdS�NFr��valuerrrrG+rHzQTestValidationErrorMessages.test_invalid_format_default_message.<locals>.<lambda>�formatZbla)rr�format_checkerzis not a)r�checksr�rLr�)r#�checkerrrrrrr�#test_invalid_format_default_message)s
�z?TestValidationErrorMessages.test_invalid_format_default_messagec
Cs�ddddiddid�d�}|jddi|tjd	�}|�|d
�td�td�td���|jdd
d�|tjd	�}|�|d�td�td�td�td���dS)Nr]FrRr^)�^abc$�^def$)rRr��patternProperties�zebra�{r�z,{} does not match any of the regexes: {}, {}r�r�i�)r��fishz.{}, {} do not match any of the regexes: {}, {}r�)r�r�Draft4Validatorrr�r�r�rrr�1test_additionalProperties_false_patternProperties8s8��������zMTestValidationErrorMessages.test_additionalProperties_false_patternPropertiescCs"|jddtjd�}|�d|�dS)Nr5Fr�z'False schema does not allow 'something')r�rrurLr�rrr�test_False_schemaVs�z-TestValidationErrorMessages.test_False_schemaN)r:rlrmr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s(


	r�c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�TestValidationErrorDetailscCs�d}dddiddigi}t�|�}t|�|��}|�t|�d�|d}|�|jd�|�|j|d�|�|j|�|�|j	|�|�
|j�|�|jt
g��|�|jt
g��|�|jt
g��|�|jt
dg��|�|jt
dg��|�|jt
dg��|�t|j�d	�t|j�\}}|�|jd�|�|j|ddd�|�|j|�|�|j	|dd�|�|j|�|�|jt
g��|�|jt
g��|�|jt
g��|�|jt
ddg��|�|jt
ddg��|�|jt
gd
���|�|j�|�|jd�|�|j|ddd�|�|j|�|�|j	|dd�|�|j|�|�|jt
g��|�|jt
g��|�|jt
g��|�|jt
ddg��|�|jt
ddg��|�|jt
gd���|�t|j�d�dS)N��anyOfr��rRr^r/rr�)r�rr�)r�r/rR)rr�r1r0rr2rr-rr�assertIsNone�parent�pathr�
relative_path�
absolute_pathr.�relative_schema_path�absolute_schema_path�context�
sorted_errors�assertIsrt�r#rrrr3r��e1�e2rrr�
test_anyOfbsb��
�z%TestValidationErrorDetails.test_anyOfcCs�ddi}dddiddddgiid�gi}t�|�}t|�|��}|�t|�d�|d	}|�|jd�|�|j|d�|�|j|�|�|j	|�|�
|j�|�|jt
g��|�|jt
g��|�|jt
g��|�|jt
dg��|�|jt
dg��|�|jt
dg��|�t|j�d�t|j�\}}|�|jd�|�|j|dd	d�|�|j|�|�|j	|dd	�|�|j|�|�|jt
g��|�|jt
g��|�|jt
g��|�|jt
d	dg��|�|jt
d	dg��|�|jt
gd
���|�|j�|�|jd�|�|jdg�|�|jd�|�|j	ddgi�|�|j|�|�|jt
dg��|�|jt
dg��|�|jt
dg��|�|jt
gd���|�|jt
gd���|�|jt
gd���|�|j�dS)
Nr*r/rRrYr]r�r��rRr�r)rRrrR)r/r�r*r�)rRr/r�r*r�)rr�r1r0rr2rr-rrr�r�r�rr�r�r.r�r�rrrrtrrrr�	test_type�sp���

��
�z$TestValidationErrorDetails.test_typec	Cs�ddgddd�}dddid	did
gd�d�d
�i}t�|�}|�|�}t|�\}}}}|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|jtdg��|�|j	d	�|�|j	d�|�|j	d�|�|j	d�dS)Nr�r/r�r�r�r�rRr^r�r�r�r�r�r�r�r*r�r�)
rr�r0rrr�rr�r�r)	r#rrrr3rr�e3�e4rrr�test_single_nesting�s4��

z.TestValidationErrorDetails.test_single_nestingcCs�ddddgid�dg}dddgddd	gid
ddid
did�d�d�d�d�}t�|�}|�|�}t|�\}}}}}	}
|�|jtg��|�|jtdg��|�|jtddg��|�|jtgd���|�|	jtgd���|�|
jtddg��|�|jtdg��|�|jtddg��|�t|j�gd��|�t|j�gd��|�t|	j�gd��|�t|
j�gd��|�|j	d�|�|j	d�|�|j	d�|�|j	d�|�|	j	d
�|�|
j	d�dS)Nr/r�r�)r*r�r�r^r]r�r�rW�requiredTr�)r�r�r)rRr�rr�)r/r�r�)r/r�r�r*rRr�)r�r�r�rR)r�r�r�r�r�r)r�r�r�r�r�r�)r�r�r*r�)
rr�r0rrr�rr.r1r)r#rrrr3rrr	r
Ze5Ze6rrr�test_multiple_nestingsV
�����

����z0TestValidationErrorDetails.test_multiple_nestingc	Csdddddgddiddd	d
iid�d�d
�giiddgdd	d
iid�}dddddddiid�id�i}t�|�}|�|�\}|�|jtdg��|�|jtgd���|j\}|�|jtgd���|�|jtgd���|j\}|�|jtgd���|�|jtgd���dS)NZnoder�r]r��childrenrRr^�^.*$�$refz#/definitions/node)rRr�)r�r)rRrr��root)ZdefinitionsrRrr�r��ab)r�rr�)rrr�)	r�rr�rr�rr�rr�)rrr�rr)r�rr�rr�rr�rr�rr�rr�rr�)rr�r0rr�rr�r)r#rrrr�rrrrr�test_recursiveFsp��������
�������
�������z)TestValidationErrorDetails.test_recursivecCs�ddd�}dddd�i}t�|�}|�|�}t|�\}}|�|jtdg��|�|jtdg��|�|jd	�|�|jd
�dS)Nr�r�r�r�rYr��rRr�r*rRr��rr�r0rrr�rr�r#rrrr3rrrrr�test_additionalProperties�s


z4TestValidationErrorDetails.test_additionalPropertiescCs�ddd�}dddiddid�i}t�|�}|�|�}t|�\}}|�|jtd	g��|�|jtd
g��|�|jd�|�|jd�dS)Nr/r�r�r�rRr^r�r�r�r*rrrrr�test_patternProperties�s
��

z1TestValidationErrorDetails.test_patternPropertiescCs�ddg}gddd�d�}t�|�}|�|�}t|�\}}|�|jtdg��|�|jtdg��|�|jd�|�|jd	�dS)
Nr*r/rYr�rr�rrRr�rrrrr�test_additionalItems�s�

z/TestValidationErrorDetails.test_additionalItemscCs�gd�}igddd�d�}t�|�}|�|�}t|�\}}|�|jtdg��|�|jtdg��|�|jd�|�|jd	�dS)
N)r*r�r/rYr�rr�r/r�rRr�rrrrr�test_additionalItems_with_items�s�

z:TestValidationErrorDetails.test_additionalItems_with_itemscCs�ddi}ddddiii}t�|�}|�|�\}|�|jd�|�|jdddidf�|�|jtg��|�|jtddg��dS)Nr*rZZ
propertyNames�notr�z%r is not allowed for %r�	rrur0rrrrr�rr.)r#rrr�errorrrr�test_propertyNames�s
�z-TestValidationErrorDetails.test_propertyNamescCspddiddid�}t�|�}|�d�\}|�|jd�|�|jd�|�|jtg��|�|jtgd���dS)Nr�rZ�
)�if�then�13 was expected)r r!r�r�r#rrrrrr�test_if_then�s�
z'TestValidationErrorDetails.test_if_thencCspddiddid�}t�|�}|�d�\}|�|jd�|�|jd�|�|jtg��|�|jtgd���dS)Nr�rZr)r �elser�r")r r%r�rr#rrr�test_if_elses�
z'TestValidationErrorDetails.test_if_elsec
CsNt�d�}|�d�\}|�|j|j|j|j|j|j	fdddddt
g�f�dS)NFrZzFalse schema does not allow 12)rrur0rrrrr-rrr.r)r#rrrrr�test_boolean_schema_Falses$
�	��z4TestValidationErrorDetails.test_boolean_schema_FalsecCs�ddddii}}tjd|itjdi||id�d�}|�d	d
i�\}|�|j|j|j|j|j	|j
|jfdddd
td	g�dditddg�f�dS)NZsomeRefr�rRrYrrB��store��resolverr*ZnotAnIntegerz''notAnInteger' is not of type 'integer')
rru�RefResolverr0rrrrr-rr�rr.r)r#�refrrrrrr�test_ref-s0��

��z#TestValidationErrorDetails.test_refN)r:rlrmrrrr
rrrrrrr$r&r'r.rrrrr�_sBJ"6br�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�MetaSchemaTestsMixincCsF|�tj��&|j�ddt�ii�Wd�n1s80YdS)Nr��test)r�r
�SchemaErrorr!�check_schemar]r"rrr�test_invalid_propertiesMsz,MetaSchemaTestsMixin.test_invalid_propertiescCs@|�tj�� |j�ddi�Wd�n1s20YdS)Nr��1)r�r
r1r!r2r"rrr�test_minItems_invalid_stringQsz1MetaSchemaTestsMixin.test_minItems_invalid_stringcCs|j�dgi�dS)z�
        Technically, all the spec says is they SHOULD have elements, not MUST.

        See https://github.com/Julian/jsonschema/issues/529.
        r�N�r!r2r"rrr�test_enum_allows_empty_arraysVsz2MetaSchemaTestsMixin.test_enum_allows_empty_arrayscCs|j�dddgi�dS)z�
        Technically, all the spec says is they SHOULD be unique, not MUST.

        See https://github.com/Julian/jsonschema/issues/529.
        r�rZNr6r"rrr�!test_enum_allows_non_unique_items^sz6MetaSchemaTestsMixin.test_enum_allows_non_unique_itemsN)r:rlrmr3r5r7r8rrrrr/Ksr/c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Ze�
ed�dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$S)%�ValidatorTestMixincCs$|j\}}|�|�|��|��dSr%)�validr_r!rv�r#rrrrr�test_valid_instances_are_validhs
z1ValidatorTestMixin.test_valid_instances_are_validcCs$|j\}}|�|�|��|��dSr%)�invalidrtr!rvr;rrr�$test_invalid_instances_are_not_validls
z7ValidatorTestMixin.test_invalid_instances_are_not_validcCs |�t�t�i�jt�d�dS)N�r)r!r]r�r"rrr�(test_non_existent_properties_are_ignoredpsz;ValidatorTestMixin.test_non_existent_properties_are_ignoredcCs|�|�i�jtj�dSr%)ZassertIsInstancer!r+rr,r"rrr�.test_it_creates_a_ref_resolver_if_not_providedss
�zAValidatorTestMixin.test_it_creates_a_ref_resolver_if_not_providedcCsndddi}}tjdi||id�}|jd|i|d�}|�tj��|�d�Wd�n1s`0YdS)NZsomeCoolRefrRrYrBr(rr*)rr,r!r�r
rr�)r#r-rr+rrrr�#test_it_delegates_to_a_ref_resolverys
z6ValidatorTestMixin.test_it_delegates_to_a_ref_resolvercsfG�fdd�dt�}|�}ddi}��tj��$�j||d��d�Wd�n1sX0YdS)zb
        Legacy RefResolvers support only the context manager form of
        resolution.
        cseZdZe�fdd��ZdS)zXValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolverc3s��|d�ddiVdS)N�the refrRrY�r)�thisr-r"rr�	resolving�szbValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolver.resolvingN)r:rlrmrrFrr"rr�LegacyRefResolver�srGrrCr*N)r]r�r
rr!r�)r#rGr+rrr"r�*test_it_delegates_to_a_legacy_ref_resolver�s
z=ValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolvercCs|�|�i��dd��dS)Nr*r^)r_r!rSr"rrr�#test_is_type_is_true_for_valid_type�sz6ValidatorTestMixin.test_is_type_is_true_for_valid_typecCs|�|�i��dd��dS)Nr*rW�rtr!rSr"rrr�&test_is_type_is_false_for_invalid_type�sz9ValidatorTestMixin.test_is_type_is_false_for_invalid_typecCs4|�|�i��dd��|�|�i��dd��dS)NTrYr\rJr"rrr�,test_is_type_evades_bool_inheriting_from_int�sz?ValidatorTestMixin.test_is_type_evades_bool_inheriting_from_intz-In Python 3 json.load always produces unicodecCs|�ddi��d�dS)NrRr^sfoo�r!r�r"rrr�$test_string_a_bytestring_is_a_string�sz7ValidatorTestMixin.test_string_a_bytestring_is_a_stringcCs|�ddi��d�dS)zF
        See https://github.com/Julian/jsonschema/issues/611.
        �patternr*NrMr"rrr�#test_patterns_can_be_native_strings�sz6ValidatorTestMixin.test_patterns_can_be_native_stringscCs~dddii}tj|j|jj�ddd��d�}||�}|�ddtd�td	�g�d
igddg}|�dd
�|�|�D�|�dS)Nr�rRr\cSst|tttf�ot|t�Sr%)�
isinstancerx�floatr�bool�r�r�rrrrG�s
�zGValidatorTestMixin.test_it_can_validate_with_decimals.<locals>.<lambda>�rr/g�������?r�r*TcSsg|]
}|j�qSrr?)rTrrrr�
<listcomp>�rHzIValidatorTestMixin.test_it_can_validate_with_decimals.<locals>.<listcomp>)	rrer!r(�redefiner�rrr0)r#rr!rr=rrr�"test_it_can_validate_with_decimals�s��
�z5ValidatorTestMixin.test_it_can_validate_with_decimalscCs"|jddit�d�}|�d�dS)Nr�Zcarrot�r�Zbugs)r!rr��r#rrrr�7test_it_returns_true_for_formats_it_does_not_know_about�s
�zJValidatorTestMixin.test_it_returns_true_for_formats_it_does_not_know_aboutcCs|�i�}|�|j�dSr%)r!r�r�rZrrr�,test_it_does_not_validate_formats_by_default�s
z?ValidatorTestMixin.test_it_does_not_validate_formats_by_defaultcs�t�}td��|jdtd���fdd��}�jddi|d�}|�d���tj��}|�d	�Wd�n1sr0Y��|j	j
��dS)
NzBad!r*)Zraisescs.|dkrdS|dkr��n��d�|��dS)N�goodT�badz What is {}? [Baby Don't Hurt Me])�failr�r��r^r#rr�check�s
zTValidatorTestMixin.test_it_validates_formats_if_a_checker_is_provided.<locals>.checkr�rYr]r^)r�
ValueErrorr�r!r�r�r
rrr��cause)r#r�rar�cmrr`r�2test_it_validates_formats_if_a_checker_is_provided�s�
(zEValidatorTestMixin.test_it_validates_formats_if_a_checker_is_providedcCsBt�}d|gi}tj|j|jj�|dd��d�}||��d�dS)NrRcSs
t|t�Sr%�rQrxrTrrrrG�rH[email protected]_non_string_custom_type.<locals>.<lambda>rUr�)r]rrer!r(rWr�)r#Znon_string_typer�Crazyrrr�test_non_string_custom_type�s
��z.ValidatorTestMixin.test_non_string_custom_typecCsttj|j|jj�ddd��d�}|�tj��"}|ddi��d�Wd�n1sT0Y|�	d	t
|j��dS)
z�
        A tuple instance properly formats validation errors for uniqueItems.

        See https://github.com/Julian/jsonschema/pull/224
        rWcSs
t|t�Sr%)rQ�tuplerTrrrrG�rHzNValidatorTestMixin.test_it_properly_formats_tuples_in_errors.<locals>.<lambda>rUZuniqueItemsT)r/r/Nz(1, 1) has non-unique elements)rrer!r(rWr�r
rr�rLrwr�)r#ZTupleValidatorr�rrr�)test_it_properly_formats_tuples_in_errors�s��0z<ValidatorTestMixin.test_it_properly_formats_tuples_in_errorsN)r:rlrmr<r>r@rArBrHrIrKrL�unittestZskipIfrrNrPrXr[r\rerhrjrrrrr9gs$

r9c@sLeZdZdZdd�Zdd�Ze�ed��dd��Z	e�ed��d	d
��Z
dS)�AntiDraft6LeakMixinzN
    Make sure functionality from draft 6 doesn't leak backwards in time.
    cCsN|�tj��}|j�d�Wd�n1s.0Y|�dt|j��dS)NTzTrue is not of type�r�r
r1r!r2rLrwr�r�rrr�test_True_is_not_a_schemas*z-AntiDraft6LeakMixin.test_True_is_not_a_schemacCsN|�tj��}|j�d�Wd�n1s.0Y|�dt|j��dS)NFzFalse is not of typermr�rrr�test_False_is_not_a_schemas*z.AntiDraft6LeakMixin.test_False_is_not_a_schemaicCs^t�di�}|�t��$}|jd|d��d�Wd�n1s@0Y|�|jtj	�dS)NrBTr*rZ�
rr,r��	Exceptionr!r�ZassertNotIsInstancer�r
r�r#r+r�rrr�5test_True_is_not_a_schema_even_if_you_forget_to_checks2zIAntiDraft6LeakMixin.test_True_is_not_a_schema_even_if_you_forget_to_checkcCs^t�di�}|�t��$}|jd|d��d�Wd�n1s@0Y|�|jtj	�dS)NrBFr*rZrprrrrr�6test_False_is_not_a_schema_even_if_you_forget_to_checks2zJAntiDraft6LeakMixin.test_False_is_not_a_schema_even_if_you_forget_to_checkN)r:rlrm�__doc__rnrork�skiprrsrtrrrrrl�s
rlc@sFeZdZejZiifZddidfZdd�Zdd�Z	dd	�Z
d
d�ZdS)
�TestDraft3ValidatorrRrYr*cCs|�ddi�}|�t��dS�NrR�any)r!r�r]rZrrr�#test_any_type_is_valid_for_type_anysz7TestDraft3Validator.test_any_type_is_valid_for_type_anycCsptj|j|jj�ddd��d�}|ddi�}|�d�|�tj��|�d�Wd�n1sb0YdS)	z(
        Sigh, because why not.
        rycSs
t|t�Sr%rfrTrrrrG*rHzBTestDraft3Validator.test_any_type_is_redefinable.<locals>.<lambda>rUrRrZr*N)	rrer!r(rWr�r�r
r)r#rgrrrr�test_any_type_is_redefinable#s��
z0TestDraft3Validator.test_any_type_is_redefinablecCs"|�|�i��t�ddi��dSrx)r_r!rvr]r"rrr�!test_is_type_is_true_for_any_type2sz5TestDraft3Validator.test_is_type_is_true_for_any_typecCs8|�|�i��dd��|�|�i��dddi��dS)NTrXrRry)r_r!rSrvr"rrr�6test_is_type_does_not_evade_bool_if_it_is_being_tested5szJTestDraft3Validator.test_is_type_does_not_evade_bool_if_it_is_being_testedN)r:rlrmrr�r!r:r=rzr{r|r}rrrrrwsrwc@s&eZdZejZiifZddidfZdS)�TestDraft4ValidatorrRrYr*N)r:rlrmrr�r!r:r=rrrrr~:sr~c@s&eZdZejZiifZddidfZdS)�TestDraft6ValidatorrRrYr*N)r:rlrmrr�r!r:r=rrrrr@src@s&eZdZejZiifZddidfZdS)�TestDraft7ValidatorrRrYr*N)r:rlrmrrur!r:r=rrrrr�Fsr�c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�TestValidatorForcCs<ddi}|�t�|�tj�ddi}|�t�|�tj�dS)N�$schema�&http://json-schema.org/draft-03/schema�'http://json-schema.org/draft-03/schema#)rr�
validator_forr�r+rrr�test_draft_3Ms��zTestValidatorFor.test_draft_3cCs<ddi}|�t�|�tj�ddi}|�t�|�tj�dS)Nr��&http://json-schema.org/draft-04/schema�'http://json-schema.org/draft-04/schema#)rrr�r�r+rrr�test_draft_4Zs��zTestValidatorFor.test_draft_4cCs<ddi}|�t�|�tj�ddi}|�t�|�tj�dS)Nr��&http://json-schema.org/draft-06/schema�'http://json-schema.org/draft-06/schema#)rrr�r�r+rrr�test_draft_6gs��zTestValidatorFor.test_draft_6cCs<ddi}|�t�|�tj�ddi}|�t�|�tj�dS)Nr��&http://json-schema.org/draft-07/schema�'http://json-schema.org/draft-07/schema#)rrr�rur+rrr�test_draft_7ts��zTestValidatorFor.test_draft_7cCs|�t�d�tj�dS)NT�rrr�Z_LATEST_VERSIONr"rrr�	test_True�s�zTestValidatorFor.test_TruecCs|�t�d�tj�dSr�r�r"rrr�
test_False�s�zTestValidatorFor.test_FalsecCs6tjddiddd�d�}ddi}|�t�|�|�dS)Nr=r@Z12cSs|�dd�SrArCrErrrrG�rHz8TestValidatorFor.test_custom_validator.<locals>.<lambda>rIr��rr rr��r#r!rrrr�test_custom_validator�s��z&TestValidatorFor.test_custom_validatorcCs0tjddidd�}ddi}|�t�|�|�dS)NrrOZ13r7r�r�r�rrr�test_custom_validator_draft6�s��z-TestValidatorFor.test_custom_validator_draft6cCs|�t�i�tj�dSr%r�r"rrr�%test_validator_for_jsonschema_default�sz6TestValidatorFor.test_validator_for_jsonschema_defaultcCs|�tjidd�d�dS)N)�default)rrr�r"rrr�!test_validator_for_custom_default�sz2TestValidatorFor.test_validator_for_custom_defaultcCs,|jtdtj|jjjtjddiid�dS)Nz�The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.r�Z
unknownSchema)rzrrr{r|rr�)r~rr�r�rlr�rr�r"rrr�1test_warns_if_meta_schema_specified_was_not_found�s�zBTestValidatorFor.test_warns_if_meta_schema_specified_was_not_foundcCs"tjiid�f|�|���dS)N)rr�)rr�rtrqr"rrr�0test_does_not_warn_if_meta_schema_is_unspecified�szATestValidatorFor.test_does_not_warn_if_meta_schema_is_unspecifiedN)r:rlrmr�r�r�r�r�r�r�r�r�r�r�r�rrrrr�Ls



r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestValidatecCs2g}|�|d|j�t�i|�|�||g�dS)Nr2)�patch�appendrr�r)r#rr!�resultrrr�
assertUses�szTestValidate.assertUsescCs,|jdditjd�|jdditjd�dS)Nr�r��rr!r�)r�rr�r"rrr�test_draft3_validator_is_chosen�s��z,TestValidate.test_draft3_validator_is_chosencCs,|jdditjd�|jdditjd�dS)Nr�r�r�r�)r�rr�r"rrr�test_draft4_validator_is_chosen�s��z,TestValidate.test_draft4_validator_is_chosencCs,|jdditjd�|jdditjd�dS)Nr�r�r�r�)r�rr�r"rrr�test_draft6_validator_is_chosen�s��z,TestValidate.test_draft6_validator_is_chosencCs,|jdditjd�|jdditjd�dS)Nr�r�r�r��r�rrur"rrr�test_draft7_validator_is_chosen�s��z,TestValidate.test_draft7_validator_is_chosencCs|jitjd�dS)Nr�r�r"rrr�$test_draft7_validator_is_the_default�sz1TestValidate.test_draft7_validator_is_the_defaultcCsR|�tj�� }t�dddi�Wd�n1s20Y|�t|j�d�dS)NrZrRr^z3(?s)Failed validating u?'.*' in schema.*On instance)r�r
rrr��assertRegexpMatchesrwr�r�rrr�test_validation_error_message�s.�z*TestValidate.test_validation_error_messagecCsR|�tj�� }t�dddi�Wd�n1s20Y|�t|j�d�dS)NrZrRz5(?s)Failed validating u?'.*' in metaschema.*On schema)r�r
r1rr�r�rwr�r�rrr�test_schema_error_message�s.�z&TestValidate.test_schema_error_messagecCsbdddiddigi}|�tj��}t�d|�Wd�n1sB0Y|�dt|j��dS)NZoneOfrRr^rWrZz12 is not of type)r�r
rrr�rLrwr�)r#rr�rrr�test_it_uses_best_matchs*z$TestValidate.test_it_uses_best_matchN)r:rlrmr�r�r�r�r�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!d"�Zd#S)$�TestRefResolverrBzfoo://storedZstoredrcCs.i|_|j|ji|_t�|j|j|j�|_dSr%)�referrer�
stored_uri�
stored_schemar)rr,�base_urir+r"rrrr$s
�zTestRefResolver.setUpcsdtjjd}���jd�fdd���j�|��}Wd�n1sF0Y��|tjj�dS)Nr=Zresolve_remotecs
��d�S)NzShould not have been called!)r_)r�r�r"rrrGrHzXTestRefResolver.test_it_does_not_retrieve_schema_urls_from_the_network.<locals>.<lambda>)rr�r'r�r+rFr�r#r-�resolvedrr"r�6test_it_does_not_retrieve_schema_urls_from_the_networks
�zFTestRefResolver.test_it_does_not_retrieve_schema_urls_from_the_networkcCsZd}dt�i|jd<|j�|��&}|�||jdd�Wd�n1sL0YdS)Nz#/properties/foor*r�)r]r�r+rFrr�rrr�test_it_resolves_local_refs%sz+TestRefResolver.test_it_resolves_local_refscCs�dddid�}tjj|dd�d�}|�d�� }|�||d	�Wd�n1sR0Y|�d
�� }|�||d	�Wd�n1s�0YdS)Nzhttp://bar/schema#r*r�)r=r�cSs|�dd�SrArCrjrrrrG/rHzETestRefResolver.test_it_resolves_local_refs_with_id.<locals>.<lambda>�rJz#/ar�zhttp://bar/schema#/a)rr,�from_schemarFr�r#rr+r�rrr�#test_it_resolves_local_refs_with_id+s�.z3TestRefResolver.test_it_resolves_local_refs_with_idcCs�|j�|j��}|�||j�Wd�n1s20Yddi|jjd<|j�d��}|�|d�Wd�n1sz0YdS)Nr*rZZ
cached_refzcached_ref#/foo)r+rFr�rr�r)r)r#r�rrr�test_it_retrieves_stored_refs6s
,z-TestRefResolver.test_it_retrieves_stored_refscCs|d}ddi}dtjvr.|�tjjdtjd�td|i�tjd<|j�|��}|�|d�Wd�n1sn0YdS)N�http://bar#bazr�rZ�requests�
http://bar)r�r�r�__setitem__�ReallyFakeRequestsr+rFr)r#r-rr�rrr�,test_it_retrieves_unstored_refs_via_requests>s
�z<TestRefResolver.test_it_retrieves_unstored_refs_via_requestscs�d}ddi�dtjvr.��tjjdtjd�dtjd<t��fdd��}��ttdtj�|t_�j�	|��}Wd�n1s�0Y��
|d�dS)Nr�r�rZr�c3s&��|d�tt����d��VdS)Nr��utf8)rr�json�dumps�encode��url�rr#rr�fake_urlopenUszQTestRefResolver.test_it_retrieves_unstored_refs_via_urlopen.<locals>.fake_urlopen�urlopen)r�r�rr�r�setattrrr�r+rFr)r#r-r�r�rr�r�+test_it_retrieves_unstored_refs_via_urlopenKs
�
z;TestRefResolver.test_it_retrieves_unstored_refs_via_urlopencCs�tjddd��0}|�tj|j�t�ddi|�Wd�n1sD0Yd�t	|j��}|j
�|��}|�|d�Wd�n1s�0YdS)NFZwt)�delete�moder*r�z
file://{}#foo)
�tempfileZNamedTemporaryFiler�os�remover�r��dumpr�r
r+rFr)r#Ztempfr-r�rrr�(test_it_retrieves_local_refs_via_urlopenas.z8TestRefResolver.test_it_retrieves_local_refs_via_urlopencCsddi}tjj|dd�d�}|�|jd�|�|jd�|�d��}|�||�Wd�n1sd0Y|�d��}|�||�Wd�n1s�0Y|�d��}|�||�Wd�n1s�0Y|�d��}|�||�Wd�n1�s0YdS)	Nr=r*cSs|�dd�SrArCrjrrrrGnrHzPTestRefResolver.test_it_can_construct_a_base_uri_from_a_schema.<locals>.<lambda>r�rB�#zfoo#�rr,r�rr�Zresolution_scoperFr�rrr�.test_it_can_construct_a_base_uri_from_a_schemajs�***z>TestRefResolver.test_it_can_construct_a_base_uri_from_a_schemacCs�i}tj�|�}|�|jd�|�|jd�|�d��}|�||�Wd�n1sX0Y|�d��}|�||�Wd�n1s�0YdS)NrBr�r�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_idcsj���fdd�}ddi�d�tjdid|id�}|����}��|��Wd�n1s\0YdS)Ncs��|���Sr%rDr��r-rr#rr�handler�s[email protected]_custom_uri_scheme_handlers.<locals>.handlerr*r��	foo://barrB��handlers)rr,rFr)r#r�r+r�rr�r�test_custom_uri_scheme_handlers�sz/TestRefResolver.test_custom_uri_scheme_handlerscs�t�g���fdd�}d}tjdidd|id�}|�|��Wd�n1sP0Y|�|��Wd�n1sz0YdS)Ncs,z
���WSty&��d�Yn0dS)Nz#Response must not have been cached!�r9�
IndexErrorr_r���responser#rrr��s
z5TestRefResolver.test_cache_remote_on.<locals>.handlerr�rBTr*�Zcache_remoter��r]rr,rF�r#r�r-r+rr�r�test_cache_remote_on�s�z$TestRefResolver.test_cache_remote_oncs^t�g���fdd�}d}tjdidd|id�}|�|��Wd�n1sP0YdS)Ncs,z
���WSty&��d�Yn0dS)NzHandler called twice!r�r�r�rrr��s
z6TestRefResolver.test_cache_remote_off.<locals>.handlerr�rBFr*r�r�r�rr�r�test_cache_remote_off�s�z%TestRefResolver.test_cache_remote_offc	s�td���fdd�}d}tjdid|id�}|�tj��D}|�|��|�d�Wd�n1sd0YWd�n1s�0Y|�|j	t����dS)	NzOh no! What's this?cs��dSr%rr��rrrr��szTTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_error.<locals>.handlerr�rBr*r�zShouldn't get this far!)
rbrr,r�r
�RefResolutionErrorrFr_rr�)r#r�r-r+�errrr�r�3test_if_you_give_it_junk_you_get_a_resolution_error�sFzCTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_errorcCs^t�di�}|��|�tj��}|��Wd�n1s>0Y|�dt|j��dS)NrBzFailed to pop the scope)	rr,Z	pop_scoper�r
r�rLrwr�)r#r+�excrrr�.test_helpful_error_message_on_failed_pop_scope�s
&z>TestRefResolver.test_helpful_error_message_on_failed_pop_scopeN)r:rlrmr�r�r�r$r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�
s$
	

r�cCsdd�}t||d�S)NcSs dd�|jD�dd�|jD�fS)NcSsg|]}t|��qSr�rwr�rrrrV�rHz.sorted_errors.<locals>.key.<locals>.<listcomp>cSsg|]}t|��qSrr�r�rrrrV�rH)r�r.r�rrr�key�s�zsorted_errors.<locals>.key)r�)r�)r3r�rrrr�src@seZdZe��Zdd�ZdS)r�cCs2|j�|�}|dur$tdt|���tt�|��S)Nz
Unknown URL: )�
_responsesrDrbr��_ReallyFakeJSONResponser�r�)r#r�r�rrrrD�szReallyFakeRequests.getN)r:rlrm�attr�ibr�rDrrrrr��sr�c@seZdZe��Zdd�ZdS)r�cCst�|j�Sr%)r��loads�	_responser"rrrr��sz_ReallyFakeJSONResponse.jsonN)r:rlrmr�r�r�r�rrrrr��sr�)0�collectionsr�
contextlibrZdecimalr�iorrkrr�r�r�r�Ztwisted.trial.unittestrr�Z
jsonschemarr	r
rZjsonschema.compatrr
Zjsonschema.tests._helpersrrrrnr�r�r�r]r/r9rlrwr~rr�r�r�r�rrFr�r�rrrr�<module>sV]"/o sN;	

© 2025 Cubjrnet7