AlkantarClanX12

Your IP : 18.222.166.127


Current Path : /opt/alt/python310/lib64/python3.10/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/unittest/__pycache__/loader.cpython-310.opt-2.pyc

o

6��f�X�@s	ddlZddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZdZ
e�dej�ZGdd�de
j�Zd	d
�Zdd�Zd
d�Zdd�Zdd�ZGdd�de�Ze�Zddd�Zejdfdd�Zdejejfdd�Zdejejfdd�Z dS)�N)�fnmatch�fnmatchcase�)�case�suite�utilTz[_a-z]\w*\.py$cs,eZdZdZ�fdd�Z�fdd�Z�ZS)�_FailedTestNcs||_tt|��|�dS�N)�
_exception�superr�__init__)�selfZmethod_name�	exception��	__class__��6/opt/alt/python310/lib64/python3.10/unittest/loader.pyrsz_FailedTest.__init__cs*|�jkr
tt���|�S�fdd�}|S)Ncs�j�r	)r
r�r
rr�testFailure!sz,_FailedTest.__getattr__.<locals>.testFailure)�_testMethodNamerr�__getattr__)r
�namerrrrrs
z_FailedTest.__getattr__)�__name__�
__module__�__qualname__rrr�
__classcell__rrrrrsrcCs"d|t��f}t|t|�||�S)Nz#Failed to import test module: %s
%s)�	traceback�
format_exc�_make_failed_test�ImportError)r�
suiteClass�messagerrr�_make_failed_import_test&s�r"cCsdt��f}t||||�S)NzFailed to call load_tests:
%s)rrr)rrr r!rrr�_make_failed_load_tests+s�r#cCst||�}||f�|fSr	)r)�
methodnamerr r!�testrrrr0s
rcCs<t�t|��dd��}||i}tdtjf|�}|||�f�S)NcSsdSr	rrrrr�testSkipped5sz'_make_skipped_test.<locals>.testSkippedZ
ModuleSkipped)r�skip�str�type�TestCase)r$rr r&ZattrsZ	TestClassrrr�_make_skipped_test4s

r+cCs*|���d�r
|dd�Stj�|�dS)Nz	$py.classi����r)�lower�endswith�os�path�splitext)r/rrr�_jython_aware_splitext<sr1cs�eZdZ	dZeej�ZdZe	j
ZdZ�fdd�Z
dd�Zdd�dd	�Zd d
d�Zd dd
�Zdd�Zd!dd�Zdd�Zdd�Zdd�Zdd�Zd"dd�Zd"dd�Z�ZS)#�
TestLoaderr%Ncs tt|���g|_t�|_dSr	)rr2r�errors�set�_loading_packagesrrrrrMszTestLoader.__init__cCsH	t|tj�rtd��|�|�}|st|d�rdg}|�t||��}|S)NzYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?ZrunTest)�
issubclassr�	TestSuite�	TypeError�getTestCaseNames�hasattrr �map)r
�
testCaseClassZ
testCaseNamesZloaded_suiterrr�loadTestsFromTestCaseTs
z TestLoader.loadTestsFromTestCase��patternc

Os6	t|�dksd|vrt�dt�|�dd�t|�dkr*t|�d}td�|���t|�dkr=t|�d}td�|���g}t|�D]}t	||�}t
|t�r]t|t
j�r]|�|�|��qCt	|dd�}	|�|�}|	dur�z|	|||�WSty�}
zt|j|
|j�\}}|j�|�|WYd}
~
Sd}
~
ww|S)NrZuse_load_testsz(use_load_tests is deprecated and ignoredrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}'�
load_tests)�len�warnings�warn�DeprecationWarning�popr8�format�sorted�dir�getattr�
isinstancer)r6rr*�appendr=r �	Exceptionr#rr3)
r
�moduler?�argsZkwsZ	complaint�testsr�objr@�e�
error_case�
error_messagerrr�loadTestsFromModulebs@�
�

���zTestLoader.loadTestsFromModulecCs4	|�d�}d\}}|durK|dd�}|rEzd�|�}t|�}Wn#tyB|��}t||j�\}}|s@|j�|�|YSYnw|s|dd�}|}	|D]S}
z
|	t	|	|
�}}	WqOt
y�}z;t	|	dd�dur|dur|j�|�|WYd}~St|
||jdt�
�f�\}}|j�|�|WYd}~Sd}~wwt|	tj�r�|�|	�St|	t�r�t|	tj�r�|�|	�St|	tj�r�t|t�r�t|tj�r�|d}||�}
tt	|
|�tj�s�|�|
g�Snt|	tj�r�|	St|	��r|	�}t|tj�r�|St|tj��r|�|g�Std|	|f��td|	��)	N�.�NNr�__path__zFailed to access attribute:
%s���z"calling %s returned %s, not a testz$don't know how to make test from: %s)�split�join�
__import__rrEr"r r3rKrI�AttributeErrorrrrrJ�types�
ModuleTyperTr)r6rr*r=�FunctionTyperr7�callabler8)r
rrM�partsrRrSZ
parts_copy�module_nameZnext_attributerP�part�parentrQ�instr%rrr�loadTestsFromName�s�

��������

�
��
�zTestLoader.loadTestsFromNamecs 	��fdd�|D�}��|�S)Ncsg|]}��|���qSr)rf)�.0r�rMr
rr�
<listcomp>�sz1TestLoader.loadTestsFromNames.<locals>.<listcomp>)r )r
�namesrMZsuitesrrhr�loadTestsFromNames�s
zTestLoader.loadTestsFromNamescs@	��fdd�}tt|t����}�jr|jt��j�d�|S)NcsZ|��j�sdSt�|�}t|�sdSd�j�j|f��jdup,t�fdd��jD��S)NFz%s.%s.%sc3s�|]}t�|�VqdSr	)r)rgr?�ZfullNamerr�	<genexpr>�s�zKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>)�
startswith�testMethodPrefixrIr`rr�testNamePatterns�any)�attrnameZtestFunc�r
r<rlr�shouldIncludeMethod�s

�
�z8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethod)�key)�list�filterrH�sortTestMethodsUsing�sort�	functools�
cmp_to_key)r
r<rtZtestFnNamesrrsrr9�szTestLoader.getTestCaseNames�test*.pycCs(	d}|dur|jdur|j}n|durd}|}tj�|�}|tjvr*tj�d|�||_d}d}g}tj�tj�|��rTtj�|�}||krStj�tj�|d��}n�zt	|�Wnt
yed}Yn�wtj|}|�d�d}	z
tj�tj�
|j��}Wndty�z|j}
Wnty�d}
Ynw|
r�|
jdur�|
jdur�d}|jD]$}|s�|�|�s�q�|�|j�dtjj��d|_|�|j||dd��q�n|jtjvr�td�d�td�|��d�Ynw|r�|s�|�|	�|_tj�|�ntj�|�|�rt
d	|��|�st|�||��}|� |�S)
NFTr�__init__.pyrU)�	namespacez2Can not use builtin modules as dotted module namesz$don't know how to discover from {!r}z%Start directory is not importable: %r)!�_top_level_dirr.r/�abspath�sys�insert�isdir�isfilerZr[r�modulesrY�dirname�__file__r\�__spec__�loader�submodule_search_locationsrWrnr�replace�sep�extend�_find_tests�builtin_module_namesr8rF� _get_directory_containing_module�removervr )r
�	start_dirr?Z
top_level_dirZset_implicit_topZis_not_importable�is_namespacerOZ
the_moduleZtop_part�specr/rrr�discover�s�
��
�
�

����

��������
zTestLoader.discovercCsNtj|}tj�|j�}tj�|����d�r!tj�	tj�	|��Stj�	|�S)Nr})
r�r�r.r/r�r��basenamer,rnr�)r
rbrM�	full_pathrrrr�`s

z+TestLoader._get_directory_containing_modulecCsB||jkrdSttj�|��}tj�||j�}|�tjjd�}|S�NrU)rr1r.r/�normpath�relpathr�r�)r
r/Z_relpathrrrr�_get_name_from_pathls
zTestLoader._get_name_from_pathcCst|�tj|Sr	)r[r�r�)r
rrrr�_get_module_from_namexs
z TestLoader._get_module_from_namecCs
t||�Sr	)r)r
r/r�r?rrr�_match_path|s
zTestLoader._match_pathFc

cs��	|�|�}|dkr$||jvr$|�|||�\}}|dur |V|s$dStt�|��}|D]@}tj�||�}	|�|	||�\}}|durF|V|rm|�|	�}|j�|�z|�	|	||�EdHW|j�
|�q-|j�
|�wq-dSr�)r�r5�_find_test_pathrGr.�listdirr/rZ�addr��discard)
r
r�r?r~rrOZshould_recurse�pathsr/r�rrrr��s6�
��
��zTestLoader._find_testsc
Csn	tj�|�}tj�|�r�t�|�sdS|�|||�sdS|�|�}z|�|�}Wn2t	j
yE}zt|||j�dfWYd}~Sd}~wt
||j�\}}	|j�|	�|dfYStj�t|d|��}
ttj�|
��}ttj�|��}|��|��kr�tj�|�}
ttj�|��}tj�|�}d}t|||
|f��|j||d�dfStj�|��r5|s�tj�tj�|d��s�dSd}d}|�|�}z|�|�}Wn2t	j
y�}zt|||j�dfWYd}~Sd}~wt
||j�\}}	|j�|	�|dfYSt|dd�}|j�|�z"|j||d�}|du�r#|dfW|j�|�S|dfW|j�|�S|j�|�wdS)	N)NFFr�zW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?r>r}r@T)r.r/r�r��VALID_MODULE_NAME�matchr�r�r�rZSkipTestr+r r"r3rKr�rIr1�realpathr,r�rrTr�rZr5r�r�)r
r�r?r~r�rrMrQrRrSZmod_filer�Zfullpath_noextZ
module_dirZmod_nameZexpected_dir�msgr@rO�packagerrrr��s�

�
�
�
�
�
���
�
�
�zTestLoader._find_test_pathr	)r|N)F)rrrro�staticmethodr�
three_way_cmprxrprr7r rrr=rTrfrkr9r�r�r�r�r�r�r�rrrrrr2Bs(

(
N
n
"r2cCs&t�}||_||_||_|r||_|Sr	)r2rxrorpr )�prefix�	sortUsingr rpr�rrr�_makeLoader�sr�cCst|||d��|�S)N)rp)r�r9)r<r�r�rprrrr9�sr9r%cC�t|||��|�Sr	)r�r=)r<r�r�r rrr�	makeSuite���r�cCr�r	)r�rT)rMr�r�r rrr�
findTestCasesr�r�rV)!r.�rer�rr]rzrBrr�rrrZ
__unittest�compile�
IGNORECASEr�r*rr"r#rr+r1�objectr2ZdefaultTestLoaderr�r�r9r7r�r�rrrr�<module>s>/
	
��