Your IP : 18.217.89.130


Current Path : /opt/alt/python39/lib64/python3.9/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/unittest/__pycache__/result.cpython-39.opt-2.pyc

a

R�f� �@sXddlZddlZddlZddlmZddlmZdZdd�ZdZ	d	Z
Gd
d�de�ZdS)�N�)�util��wrapsTcst���fdd��}|S)Ncs*t|dd�r|���|g|�Ri|��S)N�failfastF)�getattr�stop)�self�args�kw��method��4/opt/alt/python39/lib64/python3.9/unittest/result.py�inner
szfailfast.<locals>.innerr)r
rrrrrsrz
Stdout:
%sz
Stderr:
%sc@s�eZdZdZdZdZd/dd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
edd��Zedd��Zdd�Zdd�Zdd�Zdd�Zedd ��Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�ZdS)0�
TestResultNFcCsbd|_g|_g|_d|_g|_g|_g|_d|_d|_d|_	d|_
d|_tj
|_tj|_d|_dS)NFr)r�failures�errors�testsRun�skipped�expectedFailures�unexpectedSuccesses�
shouldStop�buffer�	tb_locals�_stdout_buffer�_stderr_buffer�sys�stdout�_original_stdout�stderr�_original_stderr�
_mirrorOutput)r	�streamZdescriptions�	verbosityrrr�__init__&szTestResult.__init__cCsdS�Nr�r	rrr�printErrors7szTestResult.printErrorscCs |jd7_d|_|��dS)NrF)rr"�_setupStdout�r	�testrrr�	startTest:szTestResult.startTestcCs8|jr4|jdur$t��|_t��|_|jt_|jt_dSr&)rr�io�StringIOrrrr r'rrrr)@s


zTestResult._setupStdoutcCsdSr&rr'rrr�startTestRunHszTestResult.startTestRuncCs|��d|_dS)NF)�_restoreStdoutr"r*rrr�stopTestNszTestResult.stopTestcCs�|jr�|jrltj��}tj��}|rF|�d�s6|d7}|j�t	|�|rl|�d�s\|d7}|j
�t|�|jt_|j
t_|j�
d�|j��|j�
d�|j��dS)N�
r)rr"rr�getvaluer �endswithr�write�STDOUT_LINEr!�STDERR_LINEr�seek�truncater)r	�output�errorrrrr0Ss$




zTestResult._restoreStdoutcCsdSr&rr'rrr�stopTestRunhszTestResult.stopTestRuncCs"|j�||�||�f�d|_dS�NT)r�append�_exc_info_to_stringr"�r	r+�errrrr�addErrornszTestResult.addErrorcCs"|j�||�||�f�d|_dSr=)rr>r?r"r@rrr�
addFailurevszTestResult.addFailurecCsZ|durVt|dd�r|��t|d|j�r4|j}n|j}|�||�||�f�d|_dS)NrFrT)	rr�
issubclass�failureExceptionrrr>r?r")r	r+ZsubtestrArrrr�
addSubTest}szTestResult.addSubTestcCsdSr&rr*rrr�
addSuccess�szTestResult.addSuccesscCs|j�||f�dSr&)rr>)r	r+�reasonrrr�addSkip�szTestResult.addSkipcCs|j�||�||�f�dSr&)rr>r?r@rrr�addExpectedFailure�s�zTestResult.addExpectedFailurecCs|j�|�dSr&)rr>r*rrr�addUnexpectedSuccess�szTestResult.addUnexpectedSuccesscCs>t|j�t|j�kodkno<t|d�p<t|j�dkS)Nrr)�lenrr�hasattrrr'rrr�
wasSuccessful�s$�zTestResult.wasSuccessfulcCs
d|_dSr=)rr'rrrr�szTestResult.stopc
Cs�|\}}}|�||||�}tj||||jd�}t|���}|jr�tj�	�}tj
�	�}	|rx|�d�sj|d7}|�t
|�|	r�|	�d�s�|	d7}	|�t|	�d�|�S)N)�capture_localsr2�)�_clean_tracebacks�	traceback�TracebackExceptionr�list�formatrrrr3r r4r>r6r7�join)
r	rAr+�exctype�value�tbZtb_eZmsgLinesr:r;rrrr?�s$

�



zTestResult._exc_info_to_stringc	Cs�d}d}|||fg}|r�|��\}}}|r<|�|�r<|j}q&||jurP|�|�|r^|}d}n||_|dur|j|jfD]"}|durx|�t	|�||jf�qxq|S)NTF)
�pop�_is_relevant_tb_level�tb_nextrE�_remove_unittest_tb_frames�
__traceback__�	__cause__�__context__r>�type)	r	rWrXrYr+Zret�firstZexcs�crrrrQ�s$

zTestResult._clean_tracebackscCsd|jjvS)N�
__unittest)�tb_frame�	f_globals)r	rYrrrr[�sz TestResult._is_relevant_tb_levelcCs0d}|r|�|�s|}|j}q|dur,d|_dSr&)r[r\)r	rY�prevrrrr]�sz%TestResult._remove_unittest_tb_framescCs&dt�|j�|jt|j�t|j�fS)Nz!<%s run=%i errors=%i failures=%i>)rZstrclass�	__class__rrLrrr'rrr�__repr__�s
��zTestResult.__repr__)NNN)�__name__�
__module__�__qualname__Z_previousTestClassZ_testRunEnteredZ_moduleSetUpFailedr%r(r,r)r/r1r0r<rrBrCrFrGrIrJrKrNrr?rQr[r]rirrrrrs8



	r)
r-rrRrPr�	functoolsrrdrr6r7�objectrrrrr�<module>s

?>