HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/jsonschema/tests/__pycache__/_suite.cpython-37.pyc
B

�pSeH�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlZddlm
Z
ddlmZddlZdd�Zejd	d
�Gdd�de��Zejd	d
�Gd
d�de��Zejd	dd�Gdd�de��Zdd�ZdS)z=
Python representations of the JSON Schema Test Suite tests.
�)�partialN)�FilePath)�PY3)�
validatorscCsDtj�d�}|dk	rt|�Sttj����d�}|��s@t	d��|S)NZJSON_SCHEMA_TEST_SUITE�jsonz�Can't find the JSON-Schema-Test-Suite directory. Set the 'JSON_SCHEMA_TEST_SUITE' environment variable or run the tests from alongside a checkout of the suite.)
�os�environ�getr�
jsonschema�__file__�parentZsibling�isdir�
ValueError)�root�r�H/opt/alt/python37/lib/python3.7/site-packages/jsonschema/tests/_suite.py�_find_suitesrT)�hashc@s6eZdZeje�e�d�Zdd�Zdd�Z	dd�Z
dS)	�Suite)�defaultcCsB|j�ddg�}t�tj|jdg�}dd�t�|�	d���
�D�S)N�bin�jsonschema_suite�remotescSsi|]\}}|d|�qS)zhttp://localhost:1234/r)�.0�name�schemarrr�
<dictcomp>1sz"Suite._remotes.<locals>.<dictcomp>zutf-8)�_root�
descendant�
subprocess�check_output�sys�
executable�pathr�loads�decode�items)�selfrrrrr�_remotes,s
zSuite._remotescCs&x tD]}|j|d�j|d�qWdS)N)r)�runner)r�version�	benchmark)r'r)rrrrr+6s
zSuite.benchmarkcCst||j�d|g�|��d�S)N�tests)rr#r)�Versionrrr()r'rrrrr*:sz
Suite.versionN)�__name__�
__module__�__qualname__�attr�ibZFactoryrrr(r+r*rrrrr's
rc@s\eZdZe��Ze��Ze��Zdd�Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�ZdS)r-cKs<x6|��D]*}x$|D]}|�|jt|jf|��qWq
WdS)N)r,Z
bench_func�fully_qualified_namer�validate_ignoring_errors)r'r)�kwargs�suite�testrrrr+Js

zVersion.benchmarkcs�fdd��j�d�D�S)Nc3s2|]*}�j|��dd�|d�D]
}|Vq qdS)N���)�subjectr#)�	_tests_in�basename)r�childr7)r'rr�	<genexpr>Tsz Version.tests.<locals>.<genexpr>z*.json)�_path�globChildren)r'r)r'rr,Rs
z
Version.testscs(�j�ddg�}�fdd�|�d�D�S)N�optional�formatc3s2|]*}�j|��dd�|d�D]
}|Vq qdS)Nr8)r9r#)r:r;)rr<r7)r'rrr=_sz'Version.format_tests.<locals>.<genexpr>z*.json)r>rr?)r'r#r)r'r�format_tests\s
zVersion.format_testscCs|j||j�|d�d�S)Nz.json)r9r#)r:r>r<)r'rrrr�tests_ofgszVersion.tests_ofcCs|j||j�d|dg�d�S)Nr@z.json)r9r#)r:r>r)r'rrrr�optional_tests_ofmszVersion.optional_tests_ofcs^��dd|j���}�fdd�|D�}t|tjf|�}yt�|_Wntk
rXYnX|S)NrZTestcs0i|](}|D]}|D]}|jf��|j�qqqSr)�to_unittest_method�method_name)rr6r,r7)r5rrrusz0Version.to_unittest_testcase.<locals>.<dictcomp>)	�popr�title�type�unittestZTestCase�)_someone_save_us_the_module_of_the_callerr/�	Exception)r'Zsuitesr5r�methods�clsr)r5r�to_unittest_testcasess
zVersion.to_unittest_testcasec#s>x8t�|���d��D] ����fdd��dD�VqWdS)Nzutf-8c	3s2|]*}tf���d�d�jd�|��VqdS)�descriptionr)r*r9�case_descriptionrrN)�_Testr()rr7)�eachr'r9rrr=�sz$Version._tests_in.<locals>.<genexpr>r,)rr$Z
getContentr%)r'r9r#r)rSr'r9rr:�szVersion._tests_inN)r.r/r0r1r2r>r(rr+r,rBrCrDrOr:rrrrr-Bs
r-F)r�reprc@s�eZdZe��Ze��Ze��Ze��Ze��Z	ejdd�Z
e��Ze��Zdd�Z
edd��Zedd��Zd	d
�fdd�Zd
d�Zdd�ZdS)rRF)rTcCsd�|j�S)Nz	<Test {}>)rAr3)r'rrr�__repr__�sz_Test.__repr__cCsd�|jj|j|j|jg�S)Nz > )�joinr*rr9rQrP)r'rrrr3�s
z_Test.fully_qualified_namecCsHd}dt�|d|j�t�|d|j�t�|d|j�f}tsD|�d�}|S)Nz[\W\- ]+z
test_%s_%s_%s�_zutf-8)�re�subr9rQrPr�encode)r'�
delimitersrrrrrF�s
z_Test.method_namecCsdS)Nr)r7rrr�<lambda>��z_Test.<lambda>csH�jr��fdd�}n��fdd�}�j|_|��}t�|dk	|�|�S)Ncs�jf��dS)N)�validate)�this)r5r'rr�fn�sz$_Test.to_unittest_method.<locals>.fnc	s(|�tj���jf��WdQRXdS)N)ZassertRaisesr
�ValidationErrorr^)r_)r5r'rrr`�s)�validrFr.rJZskipIf)r'�skipr5r`�reasonr)r5r'rrE�sz_Test.to_unittest_methodcKs:tjj|j|j|jd�}tjf|j|j||d�|��dS)N)r�storeZid_of)�instancerrN�resolver)r
ZRefResolverZfrom_schemarr(ZID_OFr^�data)r'�	Validatorr5rgrrrr^�s
z_Test.validatecCs,y|j|d�Wntjk
r&YnXdS)N)ri)r^r
ra)r'rirrrr4�sz_Test.validate_ignoring_errorsN)r.r/r0r1r2r*r9rQrPrhrrbr(rU�propertyr3rFrEr^r4rrrrrR�s

rRcCst�d�jdS)a�
    The FQON of the module 2nd stack frames up from here.

    This is intended to allow us to dynamicallly return test case classes that
    are indistinguishable from being defined in the module that wants them.

    Otherwise, trial will mis-print the FQON, and copy pasting it won't re-run
    the class that really is running.

    Save us all, this is all so so so so so terrible.
    �r.)r!�	_getframe�	f_globalsrrrrrK�s
rK)�__doc__�	functoolsrrrrXrr!rJZtwisted.python.filepathrr1Zjsonschema.compatrZjsonschema.validatorsrr
r�s�objectrr-rRrKrrrr�<module>s(RL