%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/jsonschema/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/jsonschema/tests/__pycache__/test_validators.cpython-312.pyc

�

`��d�&���ddlmZddlmZmZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlZddlZddlZddlZddlZddlZddlZdd	lmZmZmZmZmZdd
lmZd�ZGd�d
e�ZGd�de�Z Gd�de�Z!Gd�de"�Z#Gd�de#e"�Z$Gd�de"�Z%Gd�de%e$e�Z&Gd�de%e$e�Z'Gd�de$e�Z(Gd�de$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)�TestCase�mock)�pathname2urlN)�
FormatChecker�TypeChecker�
exceptions�	protocols�
validators)�bugc#�lK�|D]+}|jdd�tjdi|�����-y�w)N�messagezYou told me to fail!�)�
setdefaultr�ValidationError)�	validator�errors�instance�schema�eachs     �B/usr/lib/python3/dist-packages/jsonschema/tests/test_validators.py�failrs8�����1�����	�#9�:��(�(�0�4�0�0�1�s�24c�r�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�TestCreateAndExtendc�H�|j|jtjt	tj��ddi|_dti|_t�|_tj|j
|j|j��|_
y)N�$idzsome://meta/schemar)�meta_schemar�type_checker)�
addCleanup�assertEqualr�
_META_SCHEMAS�dictr"rr
r#�create�	Validator��selfs r�setUpzTestCreateAndExtend.setUp#s~���������$�$���)�)�*�	
�"�#7�8���!�4�.���'�M���#�*�*��(�(�����*�*�
���c���|j|jj|jj|jjf|j
|j|jf�y�N)r%r)�
VALIDATORS�META_SCHEMA�TYPE_CHECKERrr"r#r*s r�
test_attrszTestCreateAndExtend.test_attrs3s\��������)�)����*�*����+�+�
�
���� � ��!�!��
	
r-c�b�dgi}|j|j|�j|�y)Nr)r%r)r�r+rs  r�	test_initzTestCreateAndExtend.test_init@s*���"����������/�6�6��?r-c��dgi}|j|�}t|jd��}|j|g�y)Nr�hello)r)�list�iter_errorsr%�r+rrrs    r�test_iter_errors_successfulz/TestCreateAndExtend.test_iter_errors_successfulDs>���"����N�N�6�*�	��i�+�+�G�4�5�������$r-c
�P�dddigi}|j|�}tjdd|dddigtdg���}t	|jd��}|j
t|�d�|j
|dj�|j��y)NrrzWhoops!�goodbye)rrr�validator_value�schema_path�r)	r)rrrr9r:r%�len�	_contents)r+rr�expected_errorrs     r�test_iter_errors_one_errorz.TestCreateAndExtend.test_iter_errors_one_errorKs����I�y�1�2�3���N�N�6�*�	�#�3�3�����'��3�4��v�h��

���i�+�+�I�6�7������V��a�(�������,�,�.��0H�0H�0J�Kr-c��dddiddd�ddigi}|j|�}t|jd��}|jt	|�d	�y)
Nrr�FirstzSecond!�asdf)rr�Thirdr>�)r)r9r:r%rBr;s    r� test_iter_errors_multiple_errorsz4TestCreateAndExtend.test_iter_errors_multiple_errors\sb����G�$�%�F�;��G�$��
���N�N�6�*�	��i�+�+�I�6�7������V��a�(r-c��tjddid��}|jtjjd�|j|jd�|j|jd�y)Nr!�	something�
my version�r"�version�MyVersionValidator)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���%�%���,� �
�	�	
���
�0�0�4�4�k�B�����+�+�-A�B�����/�/�1E�Fr-c���tjddid��}|jtjjd�|jt
|i��d�y)Nr!rMrNrOz2MyVersionValidator(schema={}, format_checker=None))rr(r$r&rRr%�reprrUs  r�	test_reprzTestCreateAndExtend.test_reprrsV���%�%���,� �
�	�	
���
�0�0�4�4�k�B������2���@�	
r-c���tjddid��}|jtjjd�|jt
|dttd��i��d�y)Nr!rMrNrO�ai�zNMyVersionValidator(schema={'a': [0, 1, 2, 3, 4, 5, ...]}, format_checker=None))	rr(r$r&rRr%rXr9�rangerUs  r�test_long_reprz"TestCreateAndExtend.test_long_repr}sg���%�%���,� �
�	�	
���
�0�0�4�4�k�B������C��e�D�k�!2�3�4�5�'�	
r-c�r�tji��}|jt|i��d�y)N�r"z)Validator(schema={}, format_checker=None))rr(r%rXrUs  r�test_repr_no_versionz(TestCreateAndExtend.test_repr_no_version�s/���%�%�"�5�	������2���7�	
r-c���tjddid��}|jtjjd�|j|jd�y)Nr!rMzfoo-barrO�FooBarValidator)rr(r$r&rRr%rTrUs  r�-test_dashes_are_stripped_from_validator_nameszATestCreateAndExtend.test_dashes_are_stripped_from_validator_names�sP���%�%���,��
�	�	
���
�0�0�4�4�k�B�����/�/�1B�Cr-c��ttj�}tjddi��|j	tj|�y)N�idr_)r'rr&r(r%)r+�originals  r�6test_if_a_version_is_not_provided_it_is_not_registeredzJTestCreateAndExtend.test_if_a_version_is_not_provided_it_is_not_registered�s:���
�0�0�1�����t�T�l�3�����1�1�8�<r-c���d}d|i}tj|dd���|jtjj|�|j|tj�y)N�meta schema idrerNc�&�|jdd�S�Nre���get��ss r�<lambda>zMTestCreateAndExtend.test_validates_registers_meta_schema_id.<locals>.<lambda>����A�E�E�$��O�r-�r"rP�id_of�rr(r$r&rR�assertIn�r+�meta_schema_key�my_meta_schemas   r�'test_validates_registers_meta_schema_idz;TestCreateAndExtend.test_validates_registers_meta_schema_id�sX��*����0�����&� �+�	
�
	
���
�0�0�4�4�o�F��
�
�o�z�'?�'?�@r-c���d}d|i}tj|d��|jtjj|�|j|tj�y)N�meta schema $idr!rNrOrurws   r�.test_validates_registers_meta_schema_draft6_idzBTestCreateAndExtend.test_validates_registers_meta_schema_draft6_id�sU��+����1�����&� �	
�	
���
�0�0�4�4�o�F��
�
�o�z�'?�'?�@r-c���tjid���|jt�fd�dgfddddd	ifd
fD���y)Nr)r"rc3�V�K�|] \}}�i�j||�����"y�w))r�typeN)�is_type)�.0r�rr)s   �r�	<genexpr>z@TestCreateAndExtend.test_create_default_types.<locals>.<genexpr>�s1������"�D�(��"�
�%�%�x�d�%�C��s�&)�array)�booleanT)�integer�)�nullN)�numberg(@�object)�string�foo)rr(�
assertTrue�allrUs @r�test_create_default_typesz-TestCreateAndExtend.test_create_default_types�sW����%�%�"��D�	�������b�M�%�#�"�$��r�N�%�'��
�
	
r-c��t|jj�}t�}t	j
|jd|i��}|j
|j|j|j|jjft||��|jj|jj|f�y)N�new)r)r�)	r'r)r0r�r�extendr%r1r2)r+rfr��Extendeds    r�test_extendzTestCreateAndExtend.test_extend�s�������1�1�2���h���$�$��N�N��s�|�
��	
����#�#��$�$��%�%����)�)�	
��X�3�'����*�*����+�+��	�
	
r-c�N���fd�}d}d|d�}tj|�j�j|��}�j|j	|j
�|�tj|�}�j|j	|j
�|�y)zK
        Extending a validator preserves its notion of schema IDs.
        c�Z��|jd�jj|��S)N�__test__)rnr)�ID_OF)rr+s �rrtz3TestCreateAndExtend.test_extend_idof.<locals>.id_of�s#����:�:�j�$�.�.�*>�*>�v�*F�G�Gr-zthe://correct/id/zthe://wrong/id/)r!r�)r"rr#rtN)rr(r#r%r�r1r�)r+rt�
correct_idr"�Original�Deriveds`     r�test_extend_idofz$TestCreateAndExtend.test_extend_idof�s����	H�(�
�$�"�
���$�$�#�����*�*��	
��	
�������(<�(<�=�z�J��#�#�H�-��������w�':�':�;�Z�Hr-N)rS�
__module__rTr,r3r6r<rErKrVrYr]r`rcrgrzr}r�r�r�rr-rrr"s^��
� 
�@�%�L�")�G�	
�
�
�D�=�
A�
A�
�"
�,Ir-rc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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,d+�Z-d,�Z.y-).�TestValidationErrorMessagesc�:�|jdtj�}|j|�||g|��i|��}t	|j|��}|j
|d|����|jt|�dd|����|djS)N�clszNo errors were raised for )�msgrAz"Expected exactly one error, found r)
rRr�_LATEST_VERSION�check_schemar9r:r�r%rBr)r+rr�args�kwargsr�rrs        r�message_forz'TestValidationErrorMessages.message_for�s����j�j��
� :� :�;������ ���0��0��0�	��i�+�+�H�5�6������&@���$M��N������K�
�4�V�J�?�	�	
�
�a�y� � � r-c�R�|jdddi��}|j|d�y�NrAr�r��rr�1 is not of type 'string'�r�r%�r+rs  r�test_single_type_failurez4TestValidationErrorMessages.test_single_type_failures-���"�"�A�v�x�6H�"�I������"=�>r-c�T�|jdddgi��}|j|d�yr�r�r�s  r�test_single_type_list_failurez9TestValidationErrorMessages.test_single_type_list_failures/���"�"�A�v��z�6J�"�K������"=�>r-c�h�d}|jddt|�i��}|j|d�y)N)r�r�rAr�r�z#1 is not of type 'string', 'object')r�r9r%)r+�typesrs   r�test_multiple_type_failurez6TestValidationErrorMessages.test_multiple_type_failures6��"���"�"�A�v�t�E�{�6K�"�L������"G�Hr-c�|�dddd�gi}|jd|tj��}|j|d�y)Nr��FoorJ)�name�minimumrA�rrr�z1 is not of type 'Foo'�r�r�Draft3Validatorr%�r+rrs   r�#test_object_with_named_type_failurez?TestValidationErrorMessages.test_object_with_named_type_failuresK���E�a�8�9�:���"�"����*�*�#�
��
	
����":�;r-c�R�|jdddi��}|j|d�y)NrAr��r�z1 is less than the minimum of 2r�r�s  r�test_minimumz(TestValidationErrorMessages.test_minimums,���"�"�A�y�!�n�"�E������"C�Dr-c�R�|jdddi��}|j|d�y)NrA�maximumrr�z"1 is greater than the maximum of 0r�r�s  r�test_maximumz(TestValidationErrorMessages.test_maximums,���"�"�A�y�!�n�"�E������"F�Gr-c��d\}}d||ii}|jddi|tj��}|j|d�y�N��barr��dependenciesr�r�r�z'foo' is a dependency of 'bar'r��r+�depend�onrrs     r� test_dependencies_single_elementz<TestValidationErrorMessages.test_dependencies_single_element!sT��!�
��� �6�2�,�/���"�"��Q�Z���*�*�#�
��
	
����"B�Cr-c��dddigi}|jdd|gitj��}|j|d�y)Nr�r�rJrAr�z+1 is not of type {'type': [{'minimum': 3}]}r�)r+r�rs   r�-test_object_without_title_type_failure_draft3zITestValidationErrorMessages.test_object_without_title_type_failure_draft3+sT���)�Q��(�)���"�"���T�F�#��*�*�#�
��
	
����9�	
r-c��d\}}d||gii}|jddi|tj��}|j|d�yr�r�r�s     r�test_dependencies_list_draft3z9TestValidationErrorMessages.test_dependencies_list_draft37�V��!�
��� �6�B�4�.�1���"�"��Q�Z���*�*�#�
��
	
����"B�Cr-c��d\}}d||gii}|jddi|tj��}|j|d�yr�)r�r�Draft7Validatorr%r�s     r�test_dependencies_list_draft7z9TestValidationErrorMessages.test_dependencies_list_draft7Ar�r-c�t�|jdggdd�tj��}|jd|�y)Nr�F��items�additionalItemsr�z(2 was unexpected)�r�rr�rvr�s  r�#test_additionalItems_single_failurez?TestValidationErrorMessages.test_additionalItems_single_failureKs>���"�"��S��E�:��*�*�#�
��
	
�
�
�*�G�4r-c�v�|jgd�gdd�tj��}|jd|�y)N�rAr�rJFr�r�z(1, 2, 3 were unexpected)r�r�s  r�&test_additionalItems_multiple_failureszBTestValidationErrorMessages.test_additionalItems_multiple_failuresSs<���"�"���E�:��*�*�#�
��
	
�
�
�1�7�;r-c�^�d}ddi}|j|di|��}|jd|�y)Nr��additionalPropertiesFr�r�z('foo' was unexpected)�r�rv)r+�
additionalrrs    r�(test_additionalProperties_single_failurezDTestValidationErrorMessages.test_additionalProperties_single_failure[s9���
�(�%�0���"�"�Z��O�F�"�K���
�
�.��8r-c���ddi}|jtjddg�|��}|jt	d�|�|jt	d�|�|jd|�y)Nr�Fr�r�r�zwere unexpected))r�r'�fromkeysrvrXr�s   r�+test_additionalProperties_multiple_failureszGTestValidationErrorMessages.test_additionalProperties_multiple_failuresasi��(�%�0���"�"��]�]�E�5�>�2��#�
��
	
�
�
�d�5�k�7�+��
�
�d�5�k�7�+��
�
�(�'�2r-c�Z�ddi}|jddi|��}|jd|�y)N�constr�r�r�r�z12 was expectedr�r�s   r�
test_constz&TestValidationErrorMessages.test_constls;���2����"�"��U�^��#�
��	
�
�
�'��1r-c�~�dddii}|jdigg|tj��}|j|d�y)N�containsr�r�r�r�z4None of [2, {}, []] are valid under the given schema)r�r�Draft6Validatorr%r�s   r�test_contains_draft_6z1TestValidationErrorMessages.test_contains_draft_6tsP���w��m�,���"�"���R�[���*�*�#�
��
	
����B�	
r-c��td��}|jd�d��ddi}|jd||��}|jt	d�|�|jt	d�|�|jd|�y)	Nr)�formats�thingc��y�NFr)�values rrqzQTestValidationErrorMessages.test_invalid_format_default_message.<locals>.<lambda>�s�r-�format�bla)rr�format_checkerzis not a)r�checksr�rvrX)r+�checkerrrs    r�#test_invalid_format_default_messagez?TestValidationErrorMessages.test_invalid_format_default_message�s|����+������w�� 3�4��G�$���"�"���"�#�
��	
�
�
�d�5�k�7�+��
�
�d�7�m�W�-��
�
�j�'�*r-c��ddddiddid�d�}|jddi|tj�	�}|j|d
j	td�td�td���|jdd
d�|tj�	�}|j|dj	td�td�td�td���y)Nr�Fr�r�)�^abc$�^def$)r�r��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�Draft4Validatorr%r�rXr�s   r�1test_additionalProperties_false_patternPropertieszMTestValidationErrorMessages.test_additionalProperties_false_patternProperties�s���"�*/� &��1� &��1�(����"�"��s�^���*�*�#�
��
	
����:�A�A��W�
�t�G�}�d�7�m�
�	
��"�"�"�C�0���*�*�#�
��
	
����<�C�C��V��d�7�m�T�'�]�D��M�
�	
r-c�N�|jdd��}|j|d�y)NrMFr�z'False schema does not allow 'something'r�r�s  r�test_False_schemaz-TestValidationErrorMessages.test_False_schema�s0���"�"� ��#�
��	
����"K�Lr-c�R�|jdddi��}|j|d�y)NrJ�
multipleOfr�r�z3 is not a multiple of 2r�r�s  r�test_multipleOfz+TestValidationErrorMessages.test_multipleOf�s5���"�"�� �!�$�#�
��	
����"<�=r-c�R�|jgddi��}|j|d�y)N�minItemsr�r�z[] is too shortr�r�s  r�
test_minItemsz)TestValidationErrorMessages.test_minItems�s,���"�"�B�
�A��"�G������"3�4r-c�V�|jgd�ddi��}|j|d�y)Nr��maxItemsr�r�z[1, 2, 3] is too longr�r�s  r�
test_maxItemsz)TestValidationErrorMessages.test_maxItems�s,���"�"�I�z�1�o�"�N������"9�:r-c�\�|jgd�diigd���}|j|d�y)N�rAr�r��F�r��prefixItemsr�z%Expected at most 2 items, but found 4r�r�s  r�test_prefixItems_with_itemsz7TestValidationErrorMessages.test_prefixItems_with_items�s9���"�"�%�"�B��8�<�#�
��	
����"I�Jr-c�R�|jdddi��}|j|d�y)Nrl�	minLengthr�r�z'' is too shortr�r�s  r�test_minLengthz*TestValidationErrorMessages.test_minLength�s5���"�"����#�#�
��	
����"3�4r-c�R�|jdddi��}|j|d�y)N�abc�	maxLengthr�r�z'abc' is too longr�r�s  r�test_maxLengthz*TestValidationErrorMessages.test_maxLength�s5���"�"����#�#�
��	
����"5�6r-c�R�|jdddi��}|j|d�y)N�bbb�patternz^a*$r�z'bbb' does not match '^a*$'r�r�s  r�test_patternz(TestValidationErrorMessages.test_pattern�s5���"�"���v�&�#�
��	
����"?�@r-c�V�|jgdddii��}|j|d�y)Nr�r�r�r�z3[] does not contain items matching the given schemar�r�s  r�test_does_not_containz1TestValidationErrorMessages.test_does_not_contain�s=���"�"����� 2�3�#�
��	
����A�	
r-c�\�|jddgddidd���}|j|d�y)	Nr�rAr�r�r��r��minContainsr��MToo few items match the given schema (expected at least 2 but only 1 matched)r�r�s  r�test_contains_too_fewz1TestValidationErrorMessages.test_contains_too_few�sC���"�"��Q�Z�!'�� 2�1�E�#�
��	
����
7�	
r-c�^�|jddgddiddd���}|j|d	�y)
Nr�rAr�r�r���r�r!�maxContainsr�r"r�r�s  r�&test_contains_too_few_both_constrainedzBTestValidationErrorMessages.test_contains_too_few_both_constrained�sI���"�"��Q�Z�#�X�.� � ��#�
��	
����
�	
r-c�\�|jgd�ddidd���}|j|d�y)N�r�r��bazr�r�r��r�r'r��:Too many items match the given schema (expected at most 2)r�r�s  r�test_contains_too_manyz2TestValidationErrorMessages.test_contains_too_manys=���"�"�*�!'�� 2�1�E�#�
��	
����H�	
r-c�b�|jdgdzddiddd���}|j|d	�y)
Nr�rr�r�r�r%r&r�z:Too many items match the given schema (expected at most 4)r�r�s  r�'test_contains_too_many_both_constrainedzCTestValidationErrorMessages.test_contains_too_many_both_constrained
sI���"�"��W�q�[�#�X�.� � ��#�
��	
����H�	
r-c�R�|jdddi��}|j|d�y)NrJ�exclusiveMinimumrr�z+3 is less than or equal to the minimum of 5r�r�s  r�test_exclusiveMinimumz1TestValidationErrorMessages.test_exclusiveMinimums8���"�"��&��*�#�
��	
����9�	
r-c�R�|jdddi��}|j|d�y)NrJ�exclusiveMaximumr�r�z.3 is greater than or equal to the maximum of 2r�r�s  r�test_exclusiveMaximumz1TestValidationErrorMessages.test_exclusiveMaximum%s1���"�"�A�7I�1�6M�"�N������<�	
r-c�T�|jiddgi��}|j|d�y)N�requiredr�r�z'foo' is a required propertyr�r�s  r�
test_requiredz)TestValidationErrorMessages.test_required,s/���"�"�B�
�U�G�7L�"�M������"@�Ar-c�\�|jdiidddgii��}|j|d�y)Nr��dependentRequiredr�r�z'bar' is a dependency of 'foo'r�r�s  r�test_dependentRequiredz2TestValidationErrorMessages.test_dependentRequired0s@���"�"��R�[�'�%�%��)9�:�#�
��	
����"B�Cr-c�R�|jiddi��}|j|d�y)N�
minPropertiesr�r�z"{} does not have enough propertiesr�r�s  r�test_minPropertiesz.TestValidationErrorMessages.test_minProperties7s-���"�"�B���7K�"�L������"F�Gr-c�Z�|jiiid�ddi��}|j|d�y)N)r[�b�c�
maxPropertiesr�r�z3{'a': {}, 'b': {}, 'c': {}} has too many propertiesr�r�s  r�test_maxPropertiesz.TestValidationErrorMessages.test_maxProperties;s?���"�"��B�R�0�#�Q�'�#�
��	
����A�	
r-c�T�|jiddgi��}|j|d�y)N�oneOfFr�z.{} is not valid under any of the given schemasr�r�s  r�test_oneOf_matches_nonez3TestValidationErrorMessages.test_oneOf_matches_noneEs2���"�"�B��%��7I�"�J������<�	
r-c�V�|jidddgi��}|j|d�y)NrFTr�z${} is valid under each of True, Truer�r�s  r�test_oneOf_matches_too_manyz7TestValidationErrorMessages.test_oneOf_matches_too_manyLs1���"�"�B��$���7N�"�O������"H�Ir-c�\�ddd�}|jddg|��}|j|d�y)Nr�F�r��unevaluatedItemsr�r�r�z@Unevaluated items are not allowed ('bar', 'foo' were unexpected)r�r�s   r�test_unevaluated_itemsz2TestValidationErrorMessages.test_unevaluated_itemsPs7��!�u�=���"�"�U�E�N�6�"�J���
�
��N�	
r-c�X�ddd�}|jd|��}|j|d�y)Nr�FrKr�r�z'foo' is not of type 'array'r�r�s   r�&test_unevaluated_items_on_invalid_typezBTestValidationErrorMessages.test_unevaluated_items_on_invalid_typeXs2��!�u�=���"�"�E�&�"�A������"@�Ar-c�^�ddd�}|jddd�|��}|j|d�y)	Nr�F�r��unevaluatedPropertiesr�r��r�r�r�zEUnevaluated properties are not allowed ('bar', 'foo' were unexpected)r�r�s   r�test_unevaluated_propertiesz7TestValidationErrorMessages.test_unevaluated_properties]sI��"�U�C���"�"�����#�
��	
����
-�	
r-c�X�ddd�}|jd|��}|j|d�y)Nr�FrQr�r�z'foo' is not of type 'object'r�r�s   r�+test_unevaluated_properties_on_invalid_typezGTestValidationErrorMessages.test_unevaluated_properties_on_invalid_typels2��"�U�C���"�"�E�&�"�A������"A�Br-N)/rSr�rTr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrrrr#r(r.r0r3r6r9r<r?rDrGrIrMrOrTrVrr-rr�r��s���!�?�?�I�
<�E�H�D�

�D�D�5�<�9�	3�2�

�
+�
�<M�>�5�;�K�5�7�A�
�	
�

�
�
�
�
�B�D�H�
�
�J�
�B�


�Cr-r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TestValidationErrorDetailsc�6�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(�d�y)
Nr�anyOfr��r�r�rAr�$r�)rZrr�)rZrAr�)rr�r9r:r%rBrr?rr�assertIsNone�parent�pathr�
relative_path�
absolute_path�	json_pathr@�relative_schema_path�absolute_schema_path�context�
sorted_errors�assertIs�assertFalse�r+rrrr�e�e1�e2s        r�
test_anyOfz%TestValidationErrorDetails.test_anyOfusA������B����"��
���.�.�v�6�	��i�+�+�H�5�6������V��a�(��1�I��������g�.�����*�*�F�7�O�<�������X�.�������6�*����!�(�(�#��������r��+�������%��)�4�������%��)�4�������c�*��������w�i�(8�9�����/�/���y�1A�B�����/�/���y�1A�B�����Q�Y�Y���+��q�y�y�)���B�������y�1�����+�+�V�G�_�Q�-?�	�-J�K�������h�/�������F�7�O�A�$6�7��
�
�b�i�i��#�������%��)�,�����)�)�5��9�5�����)�)�5��9�5�������s�+���������9�~�)>�?�����0�0�%��I��2G�H�����#�#�U�+B�%C�	
�	
������$�������v�.�����+�+�V�G�_�Q�-?��-G�H�������h�/�������F�7�O�A�$6�7��
�
�b�i�i��#�������%��)�,�����)�)�5��9�5�����)�)�5��9�5�������s�+���������6�{�);�<�����0�0�%��F��2D�E�����0�0�%�8L�2M�N�����R�Z�Z��!�,r-c�"�ddi}dddiddddgiid�gi}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|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)Nr�rAr�r�r��enumr��r��
propertiesrr\)r�rr��$.foo)rArqr�ro)r�rArqr�ro)rr�r9r:r%rBrr?rrr]r^r_rr`rarbr@rcrdrerfrgrhris        r�	test_typez$TestValidationErrorDetails.test_type�sG���1�:�����#�$�#(�6�A�3�-�"8���
���.�.�v�6�	��i�+�+�H�5�6������V��a�(��1�I��������f�-�����*�*�F�6�N�;�������X�.�������6�*����!�(�(�#��������r��+�������%��)�4�������%��)�4�������c�*��������v�h��8�����/�/���x��A�����/�/���x��A�����Q�Y�Y���+��q�y�y�)���B�������v�.�����+�+�V�F�^�A�->�v�-F�G�������h�/�������F�6�N�1�$5�6��
�
�b�i�i��#�������%��)�,�����)�)�5��9�5�����)�)�5��9�5�������s�+���������6�{�);�<�����0�0�%��F��2D�E�����0�0�%�8K�2L�M�������$�������v�.�����+�+�a�S�1�������a�(�������V�a�S�M�2��
�
�b�i�i��#�������%���.�1�����)�)�5�%��>�:�����)�)�5�%��>�:�������w�/�����N�N�E�"B�C�	
�	
����#�#�U�+K�%L�	
�	
����#�#��:�;�	
�
	
������$r-c���ddgddd�}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	|jd�y)Nr�rA��spam)r�r�r+�quuxrqr�r�r�
)r�r%��)r�ror*r�r+r��$.barz$.bazrrror�)rr�r:rfr%r_rr`rarbr)	r+rrrrrkrl�e3�e4s	         r�test_single_nestingz.TestValidationErrorDetails.test_single_nestingsT���a�S��V�D�����)�"�A��#%�|�<��
���.�.�v�6�	��&�&�x�0��&�v�.���B��B�������%���.�1�������%���.�1�������%���.�1�������%���.�1�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�����)�)�5�%��>�:�������w�/�������w�/�������w�/�������w�/�������z�2�������v�.�������y�1�������v�.r-c��ddddgid�dg}dddgddd	gid
ddid
did�d�d�d�d�}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|j�gd��|j	t|j�gd��|j	t|	j�gd ��|j	t|
j�gd!��|j	|jd�|j	|jd�|j	|jd�|j	|jd�|j	|	jd
�|j	|
jd�y)"NrAr�r+rSrwr�r�rorJr�r8Tr)r�r+rp)r�r�rr�)rAr�r�)rAr�r+r�r\�$[0]z$[1].barz$[1].bar.barz$[1].bar.bazz$[1].foor�r�)r�rqr�r�)r�rqr�rqr�r8)r�rqr�rqr+r)r�rqr�ro)rr�r:rfr%r_rrbr@r9r)r+rrrrrkrlr|r}�e5�e6s           r�test_multiple_nestingz0TestValidationErrorDetails.test_multiple_nesting.s����q�%�!���6��?���!�8�,�"�Q��F�+� '�$.��#5�$.��?�'��	��
��"�.�.�v�6�	��&�&�x�0��!.�v�!6���B��B��B�������%��)�,�������%���*�-�������%��E�
�"3�4�������%�(9�":�;�������%�(9�":�;�������%��E�
�"3�4�������s�+�������v�.�������z�2�������~�6�������~�6�������z�2���������x��9����������/@�)A�B�������� �"H�	
�	
������� �K�	
�	
������� �K�	
�	
������� �"H�	
�	
������v�.�������v�.�������v�.�������z�2�������z�2�������v�.r-c	�l�dddddgddiddd	d
iid�d�d
�giiddgdd	d
iid�}dddddddiid�id�i}tj|�}|j|�\}|j|jtdg��|j|jtgd���|j|jd�|j\}|j|jtgd���|j|jtgd���|j|jd�|j\}|j|jtgd���|j|jtgd���|j|jd�y)N�noderZr�r��childrenr�r��^.*$�$refz#/definitions/node)r�r�)r�r�)r�r8rq�root)�definitionsr�r8rqr[�ab)rqr�rZz$.root)r�r�r[)	rqr�rZrrqr�r�r�rZz$.root.children.a)r�r�r[r�r�)rqr�rZrrqr�r�r�rZrrqr�r�r�rZz$.root.children.a.children.ab)	rr�r:r%rarrdrbre)r+rrrrjrkrls       r�test_recursivez)TestValidationErrorDetails.test_recursiveks����� (�%+�Z�$8�!'��%�)1�$*�(.�0D�-&�6"�)�	'�����*���!�F�,@�#A�B�1
��8
��� #� � &��#�%��
�
�
�� �.�.�v�6�	�
�
"�
"�8�
,���������%���/�:����
�"�"�E�*I�$J�	
�	
������h�/��i�i�������)�)�5�1J�+K�L�����#�#�U�
�&�	
�	
������':�;��j�j���������e�;��	
�
	
����#�#�U��&�	
�*	
������'F�Gr-c��ddd�}dddd�i}tj|�}|j|�}t|�\}}|j	|j
t
dg��|j	|j
t
dg��|j	|jd	�|j	|jd
�|j	|jd�|j	|jd�y)
Nr�r�r�r�r�r�r�r�r�r{rrr�r��	rr�r:rfr%r_rrbr�r+rrrrrkrls       r�test_additionalPropertiesz4TestValidationErrorDetails.test_additionalProperties�s��� ��+��(�9��*K�L���.�.�v�6�	��&�&�x�0���v�&���B�������%���.�1�������%���.�1�������w�/�������w�/�������v�.�������y�1r-c��ddd�}dddiddid�i}tj|�}|j|�}t|�\}}|j	|j
t
d	g��|j	|j
t
d
g��|j	|jd�|j	|jd�|j	|jd�|j	|jd�y)
NrAr�r�r�r�r�r�rr�r�r{rrr�r�s       r�test_patternPropertiesz1TestValidationErrorDetails.test_patternProperties�s����Q�'�����)�!�1�~�"�
���.�.�v�6�	��&�&�x�0���v�&���B�������%���.�1�������%���.�1�������w�/�������w�/�������v�.�������y�1r-c��ddg}gddd�d�}tj|�}|j|�}t|�\}}|j	|j
t
dg��|j	|j
t
dg��|j	|jd�|j	|jd	�|j	|jd
�|j	|jd�y)Nr�rAr�rr�r�rr��$[1]r�r�r�r�s       r�test_additionalItemsz/TestValidationErrorDetails.test_additionalItems�s����1�:���(1�a�@�
��
�.�.�v�6�	��&�&�x�0���v�&���B�������%���*�-�������%���*�-�������v�.�������v�.�������v�.�������y�1r-c��gd�}igddd�d�}tj|�}|j|�}t|�\}}|j	|j
t
dg��|j	|j
t
dg��|j	|jd�|j	|jd	�|j	|jd
�|j	|jd�y)N)r�r�rAr�rr�r�rAr�r�z$[2]r�r�r�r�s       r�test_additionalItems_with_itemsz:TestValidationErrorDetails.test_additionalItems_with_itemss���$���T�(1�a�@�
��
�.�.�v�6�	��&�&�x�0���v�&���B�������%���*�-�������%���*�-�������v�.�������v�.�������v�.�������y�1r-c��ddi}ddddiii}tj|�}|j|�\}|j|jd�|j|j
d�|j|jtg��|j|jd�|j|jtddg��y)Nr�r��
propertyNames�notr�z0'foo' should not be valid under {'const': 'foo'}r\�
rr�r:r%rrr_rrbr@)r+rrr�errors     r�test_propertyNamesz-TestValidationErrorDetails.test_propertyNamess����2�;��!�E�G�U�+;�#<�=���.�.�v�6�	��&�&�x�0���������%�0�����M�M�>�	
�	
������U�2�Y�/�������#�.�����*�*�E�?�E�2J�,K�Lr-c��ddiddid�}tj|�}|jd�\}|j|jd�|j|j
d�|j|jtg��|j|jd�|j|jtddg��y)Nr�r��
)�if�then�13 was expectedr\r�r��r+rrr�s    r�test_if_thenz'TestValidationErrorDetails.test_if_then/����B�-��b�M�
��
�.�.�v�6�	��&�&�r�*���������'�2�������(9�:�������U�2�Y�/�������#�.�����*�*�E�6�7�2C�,D�Er-c��ddiddid�}tj|�}|jd�\}|j|jd�|j|j
d�|j|jtg��|j|jd�|j|jtddg��y)	Nr�r�r�)r��elserur�r\r�r�r�s    r�test_if_elsez'TestValidationErrorDetails.test_if_else>r�r-c�2�tjd�}|jd�\}|j|j|j
|j|j|j|j|jfdddddtg�df�y)NFr�zFalse schema does not allow 12r\)rr�r:r%rrr?rrr@rbr)r+rr�s   r�test_boolean_schema_Falsez4TestValidationErrorDetails.test_boolean_schema_FalseMs����.�.�u�5�	��&�&�r�*�������
�
�����%�%��������!�!����
�1������b�	��
�	
r-c
��ddddii}}tjd|itjdi||i����}|jd	d
i�\}|j	|j
|j|j|j|j|j|j|jfdddd
td	g�dditddg�df�y)
N�someRefr�r�r�r�rl��store��resolverr��notAnIntegerz''notAnInteger' is not of type 'integer'rr)rr��RefResolverr:r%rrr?rrarr@rbr)r+�refrrr�s     r�test_refz#TestValidationErrorDetails.test_reffs����"8�6�9�:M�!N�V���.�.�
�S�M��+�+�B��3��-�H�
�	��&�&��~�'>�?�������
�
�����%�%�����#�#�����!�!����	
�:�����u�g����#��-�v�6�7��	
�	
r-c
��dddiiiddigi}tj|�}|jgd��\}}|j|j|j
|j|j|j|j|j|jfddddtd	g�dditgd
��df�|j|j|j
|j|j|j|j|j|jfdddd
tdg�dditgd��df�y)Nrr�r�r�rJr
r�rAr)rrr�r�z"5 is greater than the maximum of 3r)rrJr��$[3]�
r�Draft202012Validatorr:r%rrr?rrarr@rbr)r+rr�
type_error�	min_errors     r�test_prefixItemsz+TestValidationErrorDetails.test_prefixItems�s[���6�8�"4�b�"�y�!�n�!M�N���3�3�F�;�	� )� 5� 5�6F� G��
�I�����"�"��$�$��*�*��#�#��(�(��!�!��&�&��$�$�	
�,�����q�c�
���"��0�1��	
�	
�,	
����!�!��#�#��)�)��"�"��'�'�� � ��%�%��#�#�	
�5�����q�c�
��A���3�4��	
�	
r-c
��ddiigd�}tj|�}|jgd��\}}|j|j|j
|j|j|j|j|j|jfddddtdg�dditddg�d	f�|j|j|j
|j|j|j|j|j|jfd
dddtdg�dditddg�d
f�y)Nr�r�r)r�r�r�r%r+z2 is not of type 'string'r�rAr�r�z4 is not of type 'string'r%rJr�r��r+rrrkrls     rrz6TestValidationErrorDetails.test_prefixItems_with_items�sE���h�'��4�
���3�3�F�;�	��&�&�'B�C���B�����
�
�����"�"����� � ��	�	�������	
�,�����q�c�
���"��w��'�(��	
�	
�,	
����
�
�����"�"����� � ��	�	�������	
�,�����q�c�
���"��w��'�(��	
�	
r-c�~�ddidd�}tj|�}|jgd��\}|j|j|j
|j|j|j|j|j|jfdddgd�tg�ddidd�tdg�d	f�y
)z�
        `contains` + `maxContains` produces only one error, even if there are
        many more incorrectly matching elements.
        r�r�r�r,)r�r�r�r%r+rwr-r'r�r\Nr�r�s    rr.z1TestValidationErrorDetails.test_contains_too_many�s���
 &�x�0��C���3�3�F�;�	��&�&�'J�K�������
�
�����%�%�����#�#�����!�!����	
�M���3��b�	�$�h�/��B��z�l�#��	
�	
r-c�~�ddidd�}tj|�}|jgd��\}|j|j|j
|j|j|j|j|j|jfdddgd�tg�ddidd�tdg�d	f�y)
Nr�r�r�r )r�r�r%r"r!r�r\r�r�s    rr#z0TestValidationErrorDetails.test_contains_too_few	s���%�x�0��C���3�3�F�;�	��&�&�}�5�������
�
�����%�%�����#�#�����!�!����	
�?�����b�	�$�h�/��B��z�l�#��
�	
r-c��ddidd�}tj|�}|jddg�\}|j|j|j
|j|j|j|j|j|jfddddiddgtg�ddidd�tdg�df�y)	Nr�r�r�r r%z7[2, 4] does not contain items matching the given schemar�r\r�r�s    r�test_contains_nonez-TestValidationErrorDetails.test_contains_none's���%�x�0��C���3�3�F�;�	��&�&��1�v�.�������
�
�����%�%�����#�#�����!�!����	
�J����"��A���b�	�$�h�/��B��z�l�#��	
�	
r-c��dddgiidddgd�id�}tj|�}|jdii�\}}|j|j|j
|j|j|j|j|j|j|jf	d	ddgitdg�ddgitgd
��tgd
��df	�|j|j|j
|j|j|j|j|j|j|jf	dddgitdg�ddgd�tgd
��tgd
��df	�y)
Nr�r8r��apropz#/$defs/foor+)r�r8)z$defsrqz'bar' is a required property)rqr�r8z$.apropz'baz' is a required property)rr�r:r%rrr?rrarr@rcrbrr�s     r�test_ref_siblingz+TestValidationErrorDetails.test_ref_siblingBs����j�5�'�2�3��)�!&����
���3�3�F�;�	��&�&���}�5���B�����
�
�����"�"����� � ��	�	�����'�'����

�/������w�i� ��e�W�%��9�:��9�:��

�	
�0	
����
�
�����"�"����� � ��	�	�����'�'����

�/������w�i� �&�U�G�<��9�:��9�:��

�	
r-N)rSr�rTrmrsr~r�r�r�r�r�r�r�r�r�r�r�r�rr.r#r�r�rr-rrXrXrst��C-�JK%�Z%/�N;/�zcH�J2�"2�,2�(2�(M� 
F�
F�
�2
�>/
�b2
�h
�>
�<
�6<
r-rXc�$�eZdZd�Zd�Zd�Zd�Zy)�MetaSchemaTestsMixinc��|jtj�5|jj	ddi�ddd�y#1swYyxYw)Nrqr���assertRaisesr�SchemaErrorr)r�r*s r�test_invalid_propertiesz,MetaSchemaTestsMixin.test_invalid_properties�sB��
�
�
�z�5�5�
6�	<��N�N�'�'��r�(:�;�	<�	<�	<���A�Ac��|jtj�5|jj	ddi�ddd�y#1swYyxYw)Nr�1r�r*s r�test_minItems_invalid_stringz1MetaSchemaTestsMixin.test_minItems_invalid_string�sB��
�
�
�z�5�5�
6�	;��N�N�'�'��S�(9�:�	;�	;�	;�r�c�>�|jjdgi�y)zk
        Technically, all the spec says is they SHOULD have elements, not MUST.

        See #529.
        roN�r)r�r*s r�test_enum_allows_empty_arraysz2MetaSchemaTestsMixin.test_enum_allows_empty_arrays�s��	
���#�#�V�R�L�1r-c�B�|jjdddgi�y)zg
        Technically, all the spec says is they SHOULD be unique, not MUST.

        See #529.
        ror�Nr�r*s r�!test_enum_allows_non_unique_itemsz6MetaSchemaTestsMixin.test_enum_allows_non_unique_items�s��	
���#�#�V�b�"�X�$6�7r-N)rSr�rTr�r�r�r�rr-rr�r��s��<�;�
2�8r-r�c�~�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ValidatorTestMixinc�b�|j|ji�tj�yr/)�assertIsInstancer)rr*s r�)test_it_implements_the_validator_protocolz<ValidatorTestMixin.test_it_implements_the_validator_protocol�s!�����d�n�n�R�0�)�2E�2E�Fr-c��|j\}}|j|j|�j|��yr/)�validr�r)�is_valid�r+rrs   r�test_valid_instances_are_validz1ValidatorTestMixin.test_valid_instances_are_valid�s0���:�:����������v�.�7�7��A�Br-c��|j\}}|j|j|�j|��yr/)�invalidrhr)r�r�s   r�$test_invalid_instances_are_not_validz7ValidatorTestMixin.test_invalid_instances_are_not_valid�s2���<�<�����������/�8�8��B�Cr-c�z�|jt�t�i�jt���y)N)r)r)r��validater*s r�(test_non_existent_properties_are_ignoredz;ValidatorTestMixin.test_non_existent_properties_are_ignored�s'�������&�(�+�,�5�5�v�x�5�Hr-c�v�|j|ji�jtj�yr/)r�r)r�rr�r*s r�.test_it_creates_a_ref_resolver_if_not_providedzAValidatorTestMixin.test_it_creates_a_ref_resolver_if_not_provided�s+������N�N�2��'�'��"�"�	
r-c��dddi}}tjdi||i��}|jd|i|��}|jtj
�5|j
d�ddd�y#1swYyxYw)N�someCoolRefr�r�rlr�r�r�)rr�r)r�rrr�)r+r�rr�rs     r�#test_it_delegates_to_a_ref_resolverz6ValidatorTestMixin.test_it_delegates_to_a_ref_resolver�su��#�f�i�%8�V���)�)�"�b��f�
�F���N�N�F�C�=�8�N�D�	�
�
�
�z�9�9�
:�	%����t�$�	%�	%�	%�s�A0�0A9c��dddi}}tjdi||i��}|j||��}|jddi��}|jddi|��}|j	||�|j||�y)	Nr�r�r�rlr�r�r��r)rr�r)�evolver%�assertNotEqual)r+r�rr�rr��expecteds       r�test_evolvezValidatorTestMixin.test_evolve�s���#�f�i�%8�V���)�)�"�b��f�
�F���N�N�6�H�N�=�	����v�x�&8��9���>�>�6�8�"4�x�>�H������h�'����C��+r-c�@�tjGd�d|j��}|id��}|j|jgd��|jddi��}|j|jgd��|j|jd�y	)
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.
        c�Z�eZdZejd���Zejd��Zy)�:ValidatorTestMixin.test_evolve_with_subclass.<locals>.OhNoc�
�gd�S)Nr�rrr-rrqzCValidatorTestMixin.test_evolve_with_subclass.<locals>.OhNo.<lambda>�s��)�r-)�factory�%��defaultN)rSr�rT�attr�ibr��_barrr-r�OhNor��s#���$�'�'�"3�4�C��4�7�7�2�&�Dr-r�r�)r�r�r�r�r�N)r�rpr)r%r�r�r�)r+r�rr�s    r�test_evolve_with_subclassz,ValidatorTestMixin.test_evolve_with_subclass�s���
���	'�4�>�>�	'�
�	'����$�	�������	�2����v�y�&9��:��������)�,�������2�&r-c����G�fd�dt�}|�}ddi}�jtj�5�j	||��jd�ddd�y#1swYyxYw)zb
        Legacy RefResolvers support only the context manager form of
        resolution.
        c�"��eZdZe�fd��Zy)�XValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolverc3�>�K��j|d�ddi��y�w)N�the refr�r��r%)�thisr�r+s  �r�	resolvingzbValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver.<locals>.LegacyRefResolver.resolving�s"������ � ��i�0��y�)�)�s�N)rSr�rTrrr*s�r�LegacyRefResolverr�s���
�
*��
*r-rr�rr�N)r�r�rrr)r�)r+rr�rs`   r�*test_it_delegates_to_a_legacy_ref_resolverz=ValidatorTestMixin.test_it_delegates_to_a_legacy_ref_resolver�sk���	*��	*�%�&���)�$��
�
�
�z�9�9�
:�	E��N�N�6�H�N�5�>�>�t�D�	E�	E�	E�s�#A)�)A2c�d�|j|ji�jdd��y)Nr�r�)r�r)r�r*s r�#test_is_type_is_true_for_valid_typez6ValidatorTestMixin.test_is_type_is_true_for_valid_type�s$��������r�*�2�2�5�(�C�Dr-c�d�|j|ji�jdd��y)Nr�r��rhr)r�r*s r�&test_is_type_is_false_for_invalid_typez9ValidatorTestMixin.test_is_type_is_false_for_invalid_type�s&���������+�3�3�E�7�C�Dr-c���|j|ji�jdd��|j|ji�jdd��y)NTr�r�rr*s r�,test_is_type_evades_bool_inheriting_from_intz?ValidatorTestMixin.test_is_type_evades_bool_inheriting_from_int�sJ���������+�3�3�D�)�D�E��������+�3�3�D�(�C�Dr-c��dddii}tj|j|jjj	dd����}||�}|jddt
d�t
d�zg�d	igd
dg}|j|j|�D�cgc]}|j��c}|�ycc}w)Nr�r�r�c�^�t|tttf�xrt|t�Sr/)�
isinstance�int�floatr�bool�r�r�s  rrqzGValidatorTestMixin.test_it_can_validate_with_decimals.<locals>.<lambda>�s,��z��C���0�(�(2�$�U�D�1�1�r-�r#rAg�������?rzr�T)
rr�r)r2�redefiner�rr%r:r)r+rr)rr�r�s      r�"test_it_can_validate_with_decimalsz5ValidatorTestMixin.test_it_can_validate_with_decimals�s����F�H�-�.���%�%��N�N����4�4�=�=��2��
�	��f�%�	����A�s�G�A�J����$;�<�=��"�b�$��-�����)2�)>�)>�w�)G�H��U�^�^�H��	
��Hs�#B?c�`�|jddit���}|jd�y)Nr��carrot�r��bugs)r)rr��r+rs  r�7test_it_returns_true_for_formats_it_does_not_know_aboutzJValidatorTestMixin.test_it_returns_true_for_formats_it_does_not_know_about
s1���N�N�
�x� ���#�
�	�	���6�"r-c�\�|ji�}|j|j�yr/)r)r]r�rs  r�,test_it_does_not_validate_formats_by_defaultz?ValidatorTestMixin.test_it_does_not_validate_formats_by_defaults$���N�N�2�&�	����)�2�2�3r-c����t�}td��|jdt����fd��}�jddi|��}|j	d��jtj�5}|j	d�ddd��jjj��y#1swY�0xYw)	NzBad!r�)�raisesc�`��|dk(ry|dk(r���jdj|��y)N�goodT�badz What is {}? [Baby Don't Hurt Me])rr�)r�r%r+s ��r�checkzTValidatorTestMixin.test_it_validates_formats_if_a_checker_is_provided.<locals>.checks1��������%���	��	�	�<�C�C�E�J�Kr-r�rr$r%)r�
ValueErrorr�r)r�r�rrrg�	exception�cause)r+r�r&r�cmr%s`    @r�2test_it_validates_formats_if_a_checker_is_providedzEValidatorTestMixin.test_it_validates_formats_if_a_checker_is_provideds�����/���� ��	����j��	1�	L�
2�	L��N�N�
�u��g�#�
�	�	���6�"�
�
�
�z�9�9�
:�	&�b����u�%�	&�	
�
�
�b�l�l�(�(�#�.�		&�	&�s�=B>�>Cc���t�}d|gi}tj|j|jjj|d����}||�j
d�y)Nr�c�"�t|t�Sr/�rrrs  rrqz@ValidatorTestMixin.test_non_string_custom_type.<locals>.<lambda>6s
��z�%��'=�r-rru)r�rr�r)r2rr�)r+�non_string_typer�Crazys    r�test_non_string_custom_typez.ValidatorTestMixin.test_non_string_custom_type/s_�� �(���?�+�,���!�!��N�N����4�4�=�=��=��
��	�f�
���r�"r-c�t�tj|j|jjj	dd����}|jtj�5}|ddi�jd�ddd�|jdtj��y#1swY�/xYw)	zh
        A tuple instance properly formats validation errors for uniqueItems.

        See #224
        r�c�"�t|t�Sr/)r�tuplers  rrqzNValidatorTestMixin.test_it_properly_formats_tuples_in_errors.<locals>.<lambda>Es
��z�%��'?�r-r�uniqueItemsT)rArANz(1, 1) has non-unique elements)rr�r)r2rr�rrr�rv�strr()r+�TupleValidatorrjs   r�)test_it_properly_formats_tuples_in_errorsz<ValidatorTestMixin.test_it_properly_formats_tuples_in_errors;s���$�*�*��N�N����4�4�=�=��?��
���
�
�z�9�9�
:�	C�a��M�4�0�1�:�:�6�B�	C��
�
�6��A�K�K�8H�I�	C�	C�s�&B.�.B7c���ddd�}tdd��tj|j|jjjd��fd�d���	�}||�}t
gd
��t
dgdgg�t
dg�t
dg�gt
dg�gt
dg�ggt
dg�ggggt
dg�gggggt
t
dg�g�t
t
dg�g�g�d
d��d
d�g�d
t
dg�g��d
t
dg�g�g�d
�d
t
dg��g��d
�d
t
dg��g�gt
t
t
dg���t
t
t
dg���gg
}|D]}|j|��t
gd��t
dgdgg�t
dg�t
dg�gt
dg�gt
dg�ggt
dg�ggggt
dg�gggggt
t
dg�g�t
t
dg�g�g�d
d��d
d�g�d
t
dg�g��d
t
dg�g�g�d
�d
t
dg��g��d
�d
t
dg��g�gt
t
t
dg���t
t
t
dg���gg
}|D];}|jtj�5|j|�ddd��=y#1swY�HxYw)zO
        Allow array to validate against another defined sequence type
        r�T)r�r5�	MyMappingza, bc�.�t|ttf�Sr/)rr9rrs  rrqzBValidatorTestMixin.test_check_redefined_sequence.<locals>.<lambda>Vs��J���e�}�5�r-c�(��t|t�f�Sr/)rr')r�r�r:s  �rrqzBValidatorTestMixin.test_check_redefined_sequence.<locals>.<lambda>Ys���Z���i�0�6�r-)r�r�r)r[Nr�rlTFrr[)r[rAr[N)rrr�r)r2�
redefine_manyrr�r�rr)r+rr)r�valid_instancesr�invalid_instancesr:s       @r�test_check_redefined_sequencez0ValidatorTestMixin.test_check_redefined_sequenceLsY���"�$�7���{�F�3�	��%�%��N�N����4�4�B�B���	�	�
�	��f�%�	�
�,�-��E�7�Q�C�.�!�
�E�7�^�U�A�3�Z�(��U�G�n�
��q�c�
�|�,���w�� �!�"�
#���s���~�&6�%7�8�
�E�5�'�N�#�
$�e�U�A�3�Z�L�&9�:�
�s�A�
�	�#�u� 5�6��#��q�c�
�|�,��#��u�g��/�0�
�
�#�	�#�u�a�S�z� :�;�<��#�	�#�u�e�W�~� >�?�@�
��5���w��(�
)�5��u�a�S�z�1B�+C�D�!
��&(�	)�H����x�(�	)�
�/�"��E�7�U�G�$�%�
�E�7�^�U�E�7�^�,��U�G�n�
��u�g��/�0���w�� �!�"�
#���w��(8�'9�&:�%;�<�
�E�5�'�N�#�
$�e�U�E�7�^�,<�&=�>�
�s�E�
"�I�c�5�$9�:��#��u�g��/�0��#��u�g��/�0�
�
�#�	�#�u�e�W�~� >�?�@��#�	�#�u�e�W�~� >�?�@�
��5���w��(�
)�5��u�e�W�~�1F�+G�H�!
��&*�	-�H��"�"�:�#=�#=�>�
-��"�"�8�,�
-�
-�	-�
-�
-�s�L;�;M	N)rSr�rTr�r�r�r�r�r�r�r�rr	rrrrr r+r1r8r@rr-rr�r��sk��G�C�D�I�
�%�
,�'�,E�$E�E�E�
�*#�4�/�0
#�J�"@-r-r�c��eZdZdZd�Zd�Zejed��d��Z	ejed��d��Z
y)�AntiDraft6LeakMixinzN
    Make sure functionality from draft 6 doesn't leak backwards in time.
    c���|jtj�5}|jj	d�ddd�|jdt
j��y#1swY�/xYw)NTzTrue is not of type�r�rr�r)r�rvr6r(�r+rjs  r�test_True_is_not_a_schemaz-AntiDraft6LeakMixin.test_True_is_not_a_schema�sW��
�
�
�z�5�5�
6�	.�!��N�N�'�'��-�	.��
�
�+�S����-=�>�	.�	.���A*�*A3c���|jtj�5}|jj	d�ddd�|jdt
j��y#1swY�/xYw)NFzFalse is not of typerDrEs  r�test_False_is_not_a_schemaz.AntiDraft6LeakMixin.test_False_is_not_a_schema�sW��
�
�
�z�5�5�
6�	/�!��N�N�'�'��.�	/��
�
�,�c�!�+�+�.>�?�	/�	/�rGic��tjdi�}|jt�5}|j	d|��jd�ddd�|j
jtj�y#1swY�4xYw)NrlTr�r��
rr�r��	Exceptionr)r��assertNotIsInstancer(rr�r+r�rjs   r�5test_True_is_not_a_schema_even_if_you_forget_to_checkzIAntiDraft6LeakMixin.test_True_is_not_a_schema_even_if_you_forget_to_check�sr���)�)�"�b�1��
�
�
�y�
)�	A�Q��N�N�4�(�N�3�<�<�R�@�	A�� � ����j�.H�.H�I�	A�	A���#B�Bc��tjdi�}|jt�5}|j	d|��jd�ddd�|j
jtj�y#1swY�4xYw)NrlFr�r�rKrNs   r�6test_False_is_not_a_schema_even_if_you_forget_to_checkzJAntiDraft6LeakMixin.test_False_is_not_a_schema_even_if_you_forget_to_check�sr���)�)�"�b�1��
�
�
�y�
)�	B�Q��N�N�5�8�N�4�=�=�b�A�	B�� � ����j�.H�.H�I�	B�	B�rPN)rSr�rT�__doc__rFrI�unittest�skiprrOrRrr-rrBrB�s\���?�
@�
�X�]�]�3�s�8��J��J��X�]�]�3�s�8��J��Jr-rBc�\�eZdZUejZiifZded<ddidfZd�Z	d�Z
d�Zd	�Zy
)�TestDraft3Validator�tuple[dict, dict]r�r�r�r�c�\�|jddi�}|jt��y�Nr��any)r)r�r�rs  r�#test_any_type_is_valid_for_type_anyz7TestDraft3Validator.test_any_type_is_valid_for_type_any�s$���N�N�F�E�?�3�	����6�8�$r-c�P�tj|j|jjj	dd����}|ddi�}|jd�|j
tj�5|jd�ddd�y#1swYyxYw)z(
        Sigh, because why not.
        r[c�"�t|t�Sr/r.rs  rrqzBTestDraft3Validator.test_any_type_is_redefinable.<locals>.<lambda>�s
��j���.D�r-rr�r�r�N)	rr�r)r2rr�r�rr)r+r0rs   r�test_any_type_is_redefinablez0TestDraft3Validator.test_any_type_is_redefinable�s����!�!��N�N����4�4�=�=��D��
���6�5�/�*�	����2��
�
�
�z�9�9�
:�	&����u�%�	&�	&�	&�s�B�B%c�v�|j|jddi�jt���yrZ)r�r)r�r�r*s r�!test_is_type_is_true_for_any_typez5TestDraft3Validator.test_is_type_is_true_for_any_type�s(�����������7�@�@���J�Kr-c���|j|ji�jdd��|j|jddi�jd��y)NTr�r�r[)r�r)r�r�r*s r�6test_is_type_does_not_evade_bool_if_it_is_being_testedzJTestDraft3Validator.test_is_type_does_not_evade_bool_if_it_is_being_tested�sH��������r�*�2�2�4��C�D����������7�@�@��F�Gr-N)
rSr�rTrr�r)r��__annotations__r�r\r_rarcrr-rrWrW�sA���*�*�I� "�B�x�E��'��y�!�5�(�G�%�
&�L�Hr-rWc�D�eZdZUejZiifZded<ddidfZy)�TestDraft4ValidatorrXr�r�r�r�N)	rSr�rTrr�r)r�rdr�rr-rrfrf��+���*�*�I� "�B�x�E��'��y�!�5�(�Gr-rfc�D�eZdZUejZiifZded<ddidfZy)�TestDraft6ValidatorrXr�r�r�r�N)	rSr�rTrr�r)r�rdr�rr-rriri�rgr-ric�D�eZdZUejZiifZded<ddidfZy)�TestDraft7ValidatorrXr�r�r�r�N)	rSr�rTrr�r)r�rdr�rr-rrkrk�rgr-rkc�D�eZdZUejZiifZded<ddidfZy)�TestDraft201909ValidatorrXr�r�r�r�N)	rSr�rTr�Draft201909Validatorr)r�rdr�rr-rrmrm��+���/�/�I� "�B�x�E��'��y�!�5�(�Gr-rmc�D�eZdZUejZiifZded<ddidfZy)�TestDraft202012ValidatorrXr�r�r�r�N)	rSr�rTrr�r)r�rdr�rr-rrqrq�ror-rqc�f�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�TestValidatorForc���ddi}|jtj|�tj�ddi}|jtj|�tj�y)N�$schema�&http://json-schema.org/draft-03/schema�'http://json-schema.org/draft-03/schema#)rgr�
validator_forr�r5s  r�test_draft_3zTestValidatorFor.test_draft_3��`���E�F���
�
��$�$�V�,��&�&�	
�
�F�G���
�
��$�$�V�,��&�&�	
r-c���ddi}|jtj|�tj�ddi}|jtj|�tj�y)Nru�&http://json-schema.org/draft-04/schema�'http://json-schema.org/draft-04/schema#)rgrrxr�r5s  r�test_draft_4zTestValidatorFor.test_draft_4�rzr-c���ddi}|jtj|�tj�ddi}|jtj|�tj�y)Nru�&http://json-schema.org/draft-06/schema�'http://json-schema.org/draft-06/schema#)rgrrxr�r5s  r�test_draft_6zTestValidatorFor.test_draft_6rzr-c���ddi}|jtj|�tj�ddi}|jtj|�tj�y)Nru�&http://json-schema.org/draft-07/schema�'http://json-schema.org/draft-07/schema#)rgrrxr�r5s  r�test_draft_7zTestValidatorFor.test_draft_7rzr-c���ddi}|jtj|�tj�ddi}|jtj|�tj�y)Nruz,https://json-schema.org/draft/2019-09/schemaz-https://json-schema.org/draft/2019-09/schema#)rgrrxrnr5s  r�test_draft_201909z"TestValidatorFor.test_draft_201909 �`���K�L���
�
��$�$�V�,��+�+�	
�
�L�M���
�
��$�$�V�,��+�+�	
r-c���ddi}|jtj|�tj�ddi}|jtj|�tj�y)Nru�,https://json-schema.org/draft/2020-12/schema�-https://json-schema.org/draft/2020-12/schema#)rgrrxr�r5s  r�test_draft_202012z"TestValidatorFor.test_draft_202012-r�r-c�j�|jtjd�tj�y)NT�rgrrxr�r*s r�	test_TruezTestValidatorFor.test_True:s%���
�
��$�$�T�*��&�&�	
r-c�j�|jtjd�tj�yr�r�r*s r�
test_FalsezTestValidatorFor.test_False@s%���
�
��$�$�U�+��&�&�	
r-c��tjddidd���}ddi}|jtj|�|�y)Nreri�12c�&�|jdd�Srkrmros rrqz8TestValidatorFor.test_custom_validator.<locals>.<lambda>Jrrr-rsru�rr(rgrx�r+r)rs   r�test_custom_validatorz&TestValidatorFor.test_custom_validatorFsK���%�%��/�0��+�
�	�
�-�.���
�
��$�$�V�,��	
r-c��tjddid��}ddi}|jtj|�|�y)Nr!r|�13rOrur�r�s   r�test_custom_validator_draft6z-TestValidatorFor.test_custom_validator_draft6RsH���%�%�� 1�2��
�	��.�/���
�
��$�$�V�,��	
r-c�j�|jtji�tj�yr/r�r*s r�%test_validator_for_jsonschema_defaultz6TestValidatorFor.test_validator_for_jsonschema_default]s!���
�
�j�.�.�r�2�J�4N�4N�Or-c�R�|jtjid��d�y)Nr�)rgrrxr*s r�!test_validator_for_custom_defaultz2TestValidatorFor.test_validator_for_custom_default`s���
�
�j�.�.�r�4�@�$�Gr-c��|jt�5}tjddi��ddd�|j	j
t�|j	t|j�d�y#1swY�OxYw)Nru�
unknownSchemar�z�The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.)	�assertWarns�DeprecationWarningrrxr%�filename�__file__r6�warning)r+r*s  r�1test_warns_if_meta_schema_specified_was_not_foundzBTestValidatorFor.test_warns_if_meta_schema_specified_was_not_foundcss��
�
�
�0�
1�	J�R��$�$�Y��,H�I�	J�	
������h�/������
�
�O�
&�	
�		J�	J�s�A=�=Bc���tjd��5}tjd�tjii��ddd�|j�y#1swY�xYw)NT)�record�always)rr�)�warnings�catch_warnings�simplefilterrrxrh)r+�ws  r�0test_does_not_warn_if_meta_schema_is_unspecifiedzATestValidatorFor.test_does_not_warn_if_meta_schema_is_unspecifiedosU��
�
$�
$�D�
1�	<�Q��!�!�(�+��$�$�B��;�	<�	
�����	<�	<�s�-A�A'c�l�ddit�}}|jtj||�|�y)Nruzmailto:foo@example.com)r�rgrrx)r+rr�s   r�-test_validator_for_custom_default_with_schemaz>TestValidatorFor.test_validator_for_custom_default_with_schemaus.��$�&>�?������
�
�j�.�.�v�w�?��Ir-N)rSr�rTryr~r�r�r�r�r�r�r�r�r�r�r�r�r�rr-rrsrs�sP��
�
�
�
�
�
�
�
�

�	
�P�H�

��Jr-rsc�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�TestValidatec���g}tjj|d|j�5t	j
i|�ddd�|j
||g�y#1swY�xYw)Nr�)r
�patchr��appendrr�r%)r+rr)�results    r�
assertUseszTestValidate.assertUses{sX����
�Z�Z�
�
�y�.�&�-�-�
H�	,�����F�+�	,�����&��*�	,�	,�s�A!�!A*c��|jdditj��|jdditj��y)Nrurw�rr)rv)r�rr�r*s r�test_draft3_validator_is_chosenz,TestValidate.test_draft3_validator_is_chosen��J������H�I� �0�0�	�	
�
	
����G�H� �0�0�	�	
r-c��|jdditj��|jdditj��y)Nrur}r�r|)r�rr�r*s r�test_draft4_validator_is_chosenz,TestValidate.test_draft4_validator_is_chosen�r�r-c��|jdditj��|jdditj��y)Nrur�r�r�)r�rr�r*s r�test_draft6_validator_is_chosenz,TestValidate.test_draft6_validator_is_chosen�r�r-c��|jdditj��|jdditj��y)Nrur�r�r�)r�rr�r*s r�test_draft7_validator_is_chosenz,TestValidate.test_draft7_validator_is_chosen�r�r-c��|jdditj��|jdditj��y)Nrur�r�r��r�rr�r*s r�$test_draft202012_validator_is_chosenz1TestValidate.test_draft202012_validator_is_chosen�sR������J��!�5�5�		�	
�	
����I��!�5�5�		�	
r-c�F�|jitj��y)Nr�r�r*s r�)test_draft202012_validator_is_the_defaultz6TestValidate.test_draft202012_validator_is_the_default�s�����r�Z�-L�-L��Mr-c���|jtj�5}tjdddi�ddd�|jt
j�d�y#1swY�/xYw)Nr�r�r�z1(?s)Failed validating '.*' in schema.*On instance)r�rrrr��assertRegexr6r(rEs  r�test_validation_error_messagez*TestValidate.test_validation_error_message�s_��
�
�
�z�9�9�
:�	8�a�����V�X�$6�7�	8���������?�	
�	8�	8���A'�'A0c���|jtj�5}tjdddi�ddd�|jt
j�d�y#1swY�/xYw)Nr�r�z3(?s)Failed validating '.*' in metaschema.*On schema)r�rr�rr�r�r6r(rEs  r�test_schema_error_messagez&TestValidate.test_schema_error_message�s^��
�
�
�z�5�5�
6�	2�!�����V�R�L�1�	2���������A�	
�	2�	2�r�c��dddd�ddigi}|jtj�5}tjd|�ddd�|jdt
j��y#1swY�/xYw)	NrFr�r[r�r�r�r�z!12 is less than the minimum of 20)r�rrrr�rvr6r()r+rrjs   r�test_it_uses_best_matchz$TestValidate.test_it_uses_best_match�sv���!�b�1���!��
���
�
�z�9�9�
:�	,�a�����F�+�	,��
�
�9�3�q�{�{�;K�L�	,�	,�s�A0�0A9N)
rSr�rTr�r�r�r�r�r�r�r�r�r�rr-rr�r�zs6��+�	
�	
�	
�	
�

�N�
�
�	Mr-r�c�v�eZdZdZdZddiZd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TestRefResolverrlzfoo://stored�storedrc��i|_|j|ji|_t	j
|j|j|j�|_yr/)�referrer�
stored_uri�
stored_schemar�rr��base_urir�r*s rr,zTestRefResolver.setUp�sD����
��o�o�t�'9�'9�:��
�"�.�.��M�M�4�=�=�$�*�*�
��
r-c��tjjd}tjj|jd�5}|jj|�5}	ddd�ddd�|jtjj�|jj�y#1swY�WxYw#1swY�[xYw)Nre�resolve_remote)rr�r1r
r�r�r�rr%rh�called)r+r��patched�resolveds    r�6test_it_does_not_retrieve_schema_urls_from_the_networkzFTestRefResolver.test_it_does_not_retrieve_schema_urls_from_the_network�s����(�(�4�4�T�:��
�Z�Z�
�
�t�}�}�.>�
?�	�7����(�(��-�
���
�	�	
����:�#=�#=�#I�#I�J�������(�
�
��	�	�s$�C�$B<�&C�<C	�C�Cc���d}dt�i|jd<|jj|�5}|j	||jdd�ddd�y#1swYyxYw)Nz#/properties/foor�rq)r�r�r�rr%)r+r�r�s   r�test_it_resolves_local_refsz+TestRefResolver.test_it_resolves_local_refs�sg�� ��',�f�h�&7��
�
�l�#�
�]�]�
$�
$�S�
)�	K�X����X�t�}�}�\�'B�5�'I�J�	K�	K�	K�s�#A#�#A,c�B�dddid�}tjj|d���}|jd�5}|j	||d�ddd�|jd	�5}|j	||d�ddd�y#1swY�9xYw#1swYyxYw)
Nzhttp://bar/schema#r�r�)rer[c�&�|jdd�Srkrmr�s rrqzETestRefResolver.test_it_resolves_local_refs_with_id.<locals>.<lambda>�������D�"�!5�r-�rtz#/ar[zhttp://bar/schema#/a)rr��from_schemarr%�r+rr�r�s    r�#test_it_resolves_local_refs_with_idz3TestRefResolver.test_it_resolves_local_refs_with_id�s���,�E�5�>�B���)�)�5�5��5�6�
���
�
��
&�	4�(����X�v�c�{�3�	4�
�
�
� 6�
7�	4�8����X�v�c�{�3�	4�	4�	4�	4��	4�	4�s�B	�*B�	B�Bc�j�|jj|j�5}|j||j�ddd�ddi|jj
d<|jjd�5}|j
|d�ddd�y#1swY�[xYw#1swYyxYw)Nr�r��
cached_refzcached_ref#/foo)r�rr�rgr�r�r%)r+r�s  r�test_it_retrieves_stored_refsz-TestRefResolver.test_it_retrieves_stored_refss���
�]�]�
$�
$�T�_�_�
5�	8���M�M�(�D�$6�$6�7�	8�.3�B�K��
�
���L�)�
�]�]�
$�
$�%6�
7�	+�8����X�r�*�	+�	+�		8�	8��	+�	+�s�B�B)�B&�)B2c�l�d}ddi}dtjvr<|jtjjdtjd�t	d|i�tjd<|j
j
|�5}|j|d�ddd�y#1swYyxYw)N�http://bar#bazr+r��requests�
http://bar)�sys�modulesr$�__setitem__�ReallyFakeRequestsr�rr%)r+r�rr�s    r�,test_it_retrieves_unstored_refs_via_requestsz<TestRefResolver.test_it_retrieves_unstored_refs_via_requests	s�������������$��O�O����'�'��S�[�[��5L�
�#5�l�F�5K�"L����J��
�]�]�
$�
$�S�
)�	+�X����X�r�*�	+�	+�	+�s�B*�*B3c�����d}ddi�dtjvr<�jtjjdtjd�dtjd<t��fd��}�jt
tdtj�|t_�jj|�5}	ddd��jd�y#1swY�xYw)Nr�r+r�r�c3��K��j|d�ttj��j	d����y�w)Nr��utf8)r%r�json�dumps�encode)�urlrr+s ��r�fake_urlopenzQTestRefResolver.test_it_retrieves_unstored_refs_via_urlopen.<locals>.fake_urlopen s6��������S�,�/��$�*�*�V�,�3�3�F�;�<�<�s�AA�urlopen)r�r�r$r�r�setattrrr�r�rr%)r+r�r�r�rs`   @r�+test_it_retrieves_unstored_refs_via_urlopenz;TestRefResolver.test_it_retrieves_unstored_refs_via_urlopens��������������$��O�O����'�'��S�[�[��5L�
�#'����J��	�	=�
�	=�	
�����Y�
�8J�8J�K�)�
��
�]�]�
$�
$�S�
)�	�X��	�����2�&�	�	�s�	C&�&C/c��tjdd��5}|jtj|j
�t
jddi|�ddd�djtj
��}|jj|�5}|j|d�ddd�y#1swY�dxYw#1swYyxYw)NF�wt)�delete�moder�r�z
file://{}#foo)
�tempfile�NamedTemporaryFiler$�os�remover�r��dumpr�rr�rr%)r+�tempfr�r�s    r�(test_it_retrieves_local_refs_via_urlopenz8TestRefResolver.test_it_retrieves_local_refs_via_urlopen,s���
�
(�
(��D�
A�	-�U��O�O�B�I�I�u�z�z�2��I�I�u�e�n�e�,�	-��$�$�\�%�*�*�%=�>��
�]�]�
$�
$�S�
)�	.�X����X�u�-�	.�	.�	-�	-��
	.�	.�s�AB>�"C
�>C�
Cc��ddi}tjj|d���}|j|jd�|j|j
d�|j
d�5}|j||�ddd�|j
d�5}|j||�ddd�|j
d�5}|j||�ddd�|j
d�5}|j||�ddd�y#1swY��xYw#1swY�nxYw#1swY�NxYw#1swYyxYw)Nrer�c�&�|jdd�Srkrmr�s rrqzPTestRefResolver.test_it_can_construct_a_base_uri_from_a_schema.<locals>.<lambda>9r�r-r�rl�#zfoo#�rr�r�r%r��resolution_scoperr�s    r�.test_it_can_construct_a_base_uri_from_a_schemaz>TestRefResolver.test_it_can_construct_a_base_uri_from_a_schema5s3�������)�)�5�5��5�6�
��	
����*�*�E�2�����2�2�E�:�
�
�
��
#�	/�x����X�v�.�	/�
�
�
��
$�	/�����X�v�.�	/�
�
�
��
&�	/�(����X�v�.�	/�
�
�
��
'�	/�8����X�v�.�	/�	/�
	/�	/��	/�	/��	/�	/��	/�	/�s0�0D�D�D(�4D4�D�D%�(D1�4D=c��i}tjj|�}|j|jd�|j|j
d�|j
d�5}|j||�ddd�|j
d�5}|j||�ddd�y#1swY�6xYw#1swYyxYw)Nrlrrr�s    r�9test_it_can_construct_a_base_uri_from_a_schema_without_idzITestRefResolver.test_it_can_construct_a_base_uri_from_a_schema_without_idFs������)�)�5�5�f�=������*�*�B�/�����2�2�B�7�
�
�
��
#�	/�x����X�v�.�	/�
�
�
��
$�	/�����X�v�.�	/�	/�	/�	/��	/�	/�s�+B3�B?�3B<�?Cc���������fd�}ddi�d�tjdid|i��}|j��5}�j|��ddd�y#1swYyxYw)Nc�,���j|���Sr/r)r�r�rr+s ���r�handlerz@TestRefResolver.test_custom_uri_scheme_handlers.<locals>.handlerQs������S�#�&��Mr-r�r��	foo://barrl��handlers)rr�rr%)r+rr�r�r�rs`   @@r�test_custom_uri_scheme_handlersz/TestRefResolver.test_custom_uri_scheme_handlersPsf���	��������)�)�"�b�E�7�;K�L��
�
�
��
$�	/�����X�v�.�	/�	/�	/�s�A�A!c����t�g���fd�}d}tjdidd|i��}|j|�5	ddd�|j|�5	ddd�y#1swY�%xYw#1swYyxYw)Nc�f��	�j�S#t$r�jd�YywxYw)Nz#Response must not have been cached!�rR�
IndexErrorr�r��responser+s ��rrz5TestRefResolver.test_cache_remote_on.<locals>.handler^s3���
A��|�|�~�%���
A��	�	�?�@�
A����0�0rrlTr���cache_remoter�r�rr�r�r+rr�r�rs`   @r�test_cache_remote_onz$TestRefResolver.test_cache_remote_on[s�����H�:��	A����)�)������0@�
���
�
��
$�	��	�
�
�
��
$�	��	�	�	�	��	�	�s�A(�A4�(A1�4A=c����t�g���fd�}d}tjdidd|i��}|j|�5	ddd�y#1swYyxYw)Nc�f��	�j�S#t$r�jd�YywxYw)NzHandler called twice!rrs ��rrz6TestRefResolver.test_cache_remote_off.<locals>.handlerps0���
3��|�|�~�%���
3��	�	�1�2�
3�rrrlFr�rr!r"s`   @r�test_cache_remote_offz%TestRefResolver.test_cache_remote_offms^����H�:��	3����)�)����%��1A�
���
�
��
$�	��	�	�	�s�A
�
Ac���td���fd�}d}tjdid|i��}|jtj
�5}|j
|�5|jd�ddd�ddd�|jjt	j
���y#1swY�AxYw#1swY�ExYw)NzOh no! What's this?c�����r/r)r�r�s �rrzTTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_error.<locals>.handler�s����Kr-rrlr�rzShouldn't get this far!)
r'rr�r�r�RefResolutionErrorrrr%r()r+rr�r��errr�s     @r�3test_if_you_give_it_junk_you_get_a_resolution_errorzCTestRefResolver.test_if_you_give_it_junk_you_get_a_resolution_error}s�����0�1��	����)�)�"�b�E�7�;K�L��
�
�
�z�<�<�
=�	5���#�#�C�(�
5��	�	�3�4�
5�	5�	
������
�(E�(E�e�(L�M�
5�
5��	5�	5�s$�
B=�B1�1B=�1B:	�6B=�=Cc�"�tjdi�}|j�|jtj
�5}|j�ddd�|j
dtj��y#1swY�/xYw)NrlzFailed to pop the scope)	rr��	pop_scoper�rr)rvr6r()r+r��excs   r�.test_helpful_error_message_on_failed_pop_scopez>TestRefResolver.test_helpful_error_message_on_failed_pop_scope�so���)�)�"�b�1������
�
�
�z�<�<�
=�	!����� �	!��
�
�/��S�]�]�1C�D�	!�	!�s�B�BN)rSr�rTr�r�r�r,r�r�r�r�r�r�rrrrr#r&r+r/rr-rr�r��sd���H��J��x�(�M�
�)�K�	4�+�+�'�,.�/�"/�	/��$� N�Er-r�c�"�d�}t||��S)Nc��|jD�cgc]
}t|���c}|jD�cgc]
}t|���c}fScc}wcc}wr/)r_r6r@)r�rjs  r�keyzsorted_errors.<locals>.key�s@��"�Z�Z�(��S��V�(�"�.�.�/��S��V�/�
�	
��(��/s
�A�A)r2)�sorted)rr2s  rrfrf�s��
�
�&�c�"�"r-c�4�eZdZej�Zd�Zy)r�c��|jj|�}|�tdt|�z��t	tj|��S)Nz
Unknown URL: )�
_responsesrnr'rX�_ReallyFakeJSONResponser�r�)r+r�rs   rrnzReallyFakeRequests.get�sC���?�?�&�&�s�+���;��_�t�C�y�8�9�9�&�t�z�z�(�';�<�<r-N)rSr�rTr�r�r6rnrr-rr�r��s�������J�=r-r�c�4�eZdZej�Zd�Zy)r7c�@�tj|j�Sr/)r��loads�	_responser*s rr�z_ReallyFakeJSONResponse.json�s���z�z�$�.�.�)�)r-N)rSr�rTr�r�r;r�rr-rr7r7�s������	�I�*r-r7)3�
__future__r�collectionsrr�
contextlibr�decimalr�iorrTr	r
�urllib.requestrr�rr�rr�r��
jsonschemarr
rrr�jsonschema.tests._helpersrrrr�rXr�r�r�rBrWrfrirkrmrqrsr�r�rfrpr�r7rr-r�<module>rDsy��"�)�%���#�'��	�
�������*�1�PI�(�PI�fzC�(�zC�zL
��L
�^8�6�8�8o-�-�v�o-�dJ�&�J�<H�-�/A�8�H�@)�-�/A�8�)�)�,�h�)�)�,�h�)�)�1�8�)�)�1�8�)�LJ�x�LJ�^^M�8�^M�BtE�h�tE�n#����=��=��=����*�f�*��*r-

Zerion Mini Shell 1.0