ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/loader.cpython-37.opt-2.pyc

B

0��c�X�@sddlZddlZddlZddlZddlZddlZddlZddlmZmZddl	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__��4/opt/alt/python37/lib64/python3.7/unittest/loader.pyrsz_FailedTest.__init__cs*|�jkrtt���|�S�fdd�}|S)Ncs
�j�dS)N)r	r)rrr�testFailure!sz,_FailedTest.__getattr__.<locals>.testFailure)�_testMethodNamer
r�__getattr__)r�namer)r)rrrs
z_FailedTest.__getattr__)�__name__�
__module__�__qualname__rrr�
__classcell__rr)rrrs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&srcCsdt��f}t||||�S)NzFailed to call load_tests:
%s)rrr)rr
rrrrr�_make_failed_load_tests+sr cCst||�}||f�|fS)N)r)�
methodnamer
rr�testrrrr0s
rcCs<t�t|��dd��}||i}tdtjf|�}|||�f�S)NcSsdS)Nr)rrrr�testSkipped5sz'_make_skipped_test.<locals>.testSkippedZ
ModuleSkipped)r�skip�str�type�TestCase)r!r
rr#ZattrsZ	TestClassrrr�_make_skipped_test4sr(cCs*|���d�r|dd�Stj�|�dS)Nz	$py.classi����r)�lower�endswith�os�path�splitext)r,rrr�_jython_aware_splitext<sr.cs�eZdZdZeej�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�|_dS)N)r
r/r�errors�set�_loading_packages)r)rrrrMszTestLoader.__init__cCsFt|tj�rtd��|�|�}|s2t|d�r2dg}|�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

Os4t|�dksd|kr,t�dt�|�dd�t|�dkrRt|�d}td�|���t|�dkrxt|�d}td�|���g}x@t|�D]4}t	||�}t
|t�r�t|t
j�r�|�|�|��q�Wt	|dd�}	|�|�}|	dk	�r0y|	|||�Stk
�r.}
z$t|j|
|j�\}}|j�|�|Sd}
~
XYnX|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�popr5�format�sorted�dir�getattr�
isinstancer&r3rr'�appendr:r�	Exceptionr rr0)
r�moduler;�argsZkwsZ	complaint�testsr�objr<�e�
error_case�
error_messagerrr�loadTestsFromModulebs4


zTestLoader.loadTestsFromModulecCs>|�d�}d\}}|dkr�|dd�}xb|r�yd�|�}t|�}PWq(tk
r�|��}t||j�\}}|s�|j�|�|SYq(Xq(W|dd�}|}	x�|D]�}
y|	t	|	|
�}}	Wq�t
k
�r2}zZt	|	dd�dk	r�|dk	r�|j�|�|St|
||jdt�
�f�\}}|j�|�|SWdd}~XYq�Xq�Wt|	tj��rP|�|	�St|	t��rtt|	tj��rt|�|	�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��ntd|	��dS)	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__rrArrr0rGrE�AttributeErrorrrrrF�types�
ModuleTyperPr&r3rr'r:�FunctionTyperr4�callabler5)rrrI�partsrNrOZ
parts_copy�module_nameZnext_attributerL�part�parentrM�instr"rrr�loadTestsFromName�sl	





zTestLoader.loadTestsFromNamecs��fdd�|D�}��|�S)Ncsg|]}��|���qSr)ra)�.0r)rIrrr�
<listcomp>�sz1TestLoader.loadTestsFromNames.<locals>.<listcomp>)r)r�namesrIZsuitesr)rIrr�loadTestsFromNames�szTestLoader.loadTestsFromNamescs>��fdd�}tt|t����}�jr:|jt��j�d�|S)NcsZ|��j�sdSt�|�}t|�s&dSd�j�j|f��jdkpXt�fdd��jD��S)NFz%s.%s.%sc3s|]}t�|�VqdS)N)r)rbr;)�fullNamerr�	<genexpr>�szKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>)�
startswith�testMethodPrefixrEr[rr�testNamePatterns�any)ZattrnameZtestFunc)rr9)rfr�shouldIncludeMethod�s

z8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethod)�key)�list�filterrD�sortTestMethodsUsing�sort�	functools�
cmp_to_key)rr9rlZtestFnNamesr)rr9rr6�s
zTestLoader.getTestCaseNames�test*.pycCsNd}|dkr|jdk	r|j}n|dkr.d}|}tj�|�}|tjkrRtj�d|�||_d}d}g}tj�tj�|��r�tj�|�}||kr�tj�tj�|d��}�ntyt	|�Wnt
k
r�d}Y�nNXtj|}|�d�d}	ytj�tj�
|j��}Wn�tk
�r�y
|j}
Wntk
�r8d}
YnX|
�r�|
jdk�r�|
jdk	�r�d}x�|jD]P}|�s~|�|��s~�qd|�|j�dtjj��d|_|�|j||dd���qdWn*|jtjk�r�td�d�ntd�|��d�YnX|�r|�s|�|	�|_tj�|�ntj�|�|�r.t
d	|��|�sDt|�||��}|� |�S)
NFTrz__init__.pyrQ)�	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�isfilerUrVr�modulesrT�dirname�__file__rW�__spec__�loader�submodule_search_locationsrRrhr�replace�sep�extend�_find_tests�builtin_module_namesr5rB� _get_directory_containing_module�removernr)r�	start_dirr;Z
top_level_dirZset_implicit_topZis_not_importable�is_namespacerKZ
the_moduleZtop_part�specr,rrr�discover�sv





zTestLoader.discovercCsRtj|}tj�|j�}tj�|����d�rBtj�	tj�	|��Stj�	|�SdS)Nz__init__.py)
rxr|r+r,rwr~�basenamer)rhr})rr]rI�	full_pathrrrr�`s

z+TestLoader._get_directory_containing_modulecCsB||jkrdSttj�|��}tj�||j�}|�tjjd�}|S)NrQ)rvr.r+r,�normpath�relpathr�r�)rr,Z_relpathrrrr�_get_name_from_pathls
zTestLoader._get_name_from_pathcCst|�tj|S)N)rVrxr|)rrrrr�_get_module_from_namexsz TestLoader._get_module_from_namecCs
t||�S)N)r)rr,r�r;rrr�_match_path|szTestLoader._match_pathFc

cs�|�|�}|dkrD||jkrD|�|||�\}}|dk	r<|V|sDdStt�|��}x||D]t}tj�||�}	|�|	||�\}}|dk	r�|V|rX|�|	�}|j�|�z|�	|	||�EdHWd|j�
|�XqXWdS)NrQ)r�r2�_find_test_pathrCr+�listdirr,rU�addr��discard)
rr�r;rurrKZshould_recurse�pathsr,r�rrrr��s*


zTestLoader._find_testsc
CsPtj�|�}tj�|��rHt�|�s(dS|�|||�s:dS|�|�}y|�|�}WnZt	j
k
r�}zt|||j�dfSd}~XYn�t
||j�\}}	|j�|	�|dfStj�t|d|��}
ttj�|
��}ttj�|��}|��|��k�r2tj�|�}
ttj�|��}tj�|�}d}t|||
|f��|j||d�dfS�ntj�|��rH|�sxtj�tj�|d���sxdSd}d}|�|�}y|�|�}Wn\t	j
k
�r�}zt|||j�dfSd}~XYnzt
||j�\}}	|j�|	�|dfSt|dd�}|j�|�z(|j||d�}|dk	�r0|dfS|dfS|j�|�XndSdS)	N)NFFr~zW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?)r;z__init__.pyr<T)r+r,r�r{�VALID_MODULE_NAME�matchr�r�r�rZSkipTestr(rrr0rGrwrEr.�realpathr)r}rrPrzrUr2r�r�)rr�r;rur�rrIrMrNrOZmod_filer�Zfullpath_noextZ
module_dirZmod_nameZexpected_dir�msgr<rK�packagerrrr��sl



zTestLoader._find_test_path)N)N)rtN)F)F)rrrri�staticmethodr�
three_way_cmprprjrr4rrvrr:rPrarer6r�r�r�r�r�r�r�rrr)rrr/Bs$
(
N

n
"r/cCs&t�}||_||_||_|r"||_|S)N)r/rprirjr)�prefix�	sortUsingrrjr�rrr�_makeLoader�sr�cCst|||d��|�S)N)rj)r�r6)r9r�r�rjrrrr6�sr6r"cCst|||��|�S)N)r�r:)r9r�r�rrrr�	makeSuite�sr�cCst|||��|�S)N)r�rP)rIr�r�rrrr�
findTestCasessr�)NN)!r+�rerxrrXrrr>rr�rrrZ
__unittest�compile�
IGNORECASEr�r'rrr rr(r.�objectr/ZdefaultTestLoaderr�r�r6r4r�r�rrrr�<module>s6/
	

Zerion Mini Shell 1.0