Your IP : 18.118.137.13


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

o

6��fs�@sndZddlZddlZddlZddlmZddlmZdZGdd�de	�Z
Gd	d
�d
ej�ZGdd�de	�Z
dS)
z
Running tests�N�)�result)�registerResultTc@s*eZdZdZdd�Zdd�Zd	dd�ZdS)
�_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcCs
||_dS�N)�stream)�selfr�r	�6/opt/alt/python310/lib64/python3.10/unittest/runner.py�__init__s
z_WritelnDecorator.__init__cCs|dvrt|��t|j|�S)N)r�__getstate__)�AttributeError�getattrr)r�attrr	r	r
�__getattr__sz_WritelnDecorator.__getattr__NcCs|r|�|�|�d�dS�N�
)�write)r�argr	r	r
�writelns
z_WritelnDecorator.writelnr)�__name__�
__module__�__qualname__�__doc__rrrr	r	r	r
r
s
rcs�eZdZdZdZdZ�fdd�Zdd�Z�fdd	�Z�fd
d�Z	�fdd
�Z
�fdd�Z�fdd�Z�fdd�Z
�fdd�Zdd�Zdd�Z�ZS)�TextTestResultzhA test result class that can print formatted text results to a stream.

    Used by TextTestRunner.
    zF======================================================================zF----------------------------------------------------------------------cs8tt|��|||�||_|dk|_|dk|_||_dS)Nr)�superrrr�showAll�dots�descriptions)rrr�	verbosity��	__class__r	r
r%s



zTextTestResult.__init__cCs,|��}|jr|rd�t|�|f�St|�Sr)ZshortDescriptionr�join�str)r�testZdoc_first_liner	r	r
�getDescription,s
zTextTestResult.getDescriptioncsFtt|��|�|jr!|j�|�|��|j�d�|j��dSdS)Nz ... )rr�	startTestrrrr%�flush�rr$r r	r
r&3s�zTextTestResult.startTestc�Ttt|��|�|jr|j�d�|j��dS|jr(|j�d�|j��dSdS)N�ok�.)	rr�
addSuccessrrrr'rrr(r r	r
r,:��zTextTestResult.addSuccessc�Vtt|��||�|jr|j�d�|j��dS|jr)|j�d�|j��dSdS)N�ERROR�E)	rr�addErrorrrrr'rr�rr$�errr r	r
r1C��zTextTestResult.addErrorcr.)N�FAIL�F)	rr�
addFailurerrrr'rrr2r r	r
r7Lr4zTextTestResult.addFailurecs\tt|��||�|jr|j�d�|��|j��dS|jr,|j�	d�|j��dSdS)Nz
skipped {0!r}�s)
rr�addSkiprrr�formatr'rr)rr$�reasonr r	r
r9Us�zTextTestResult.addSkipcr.)Nzexpected failure�x)	rr�addExpectedFailurerrrr'rrr2r r	r
r=^r4z!TextTestResult.addExpectedFailurecr))Nzunexpected success�u)	rr�addUnexpectedSuccessrrrr'rrr(r r	r
r?gr-z#TextTestResult.addUnexpectedSuccesscCs@|js|jr|j��|j��|�d|j�|�d|j�dS)Nr/r5)rrrrr'�printErrorList�errors�failures�rr	r	r
�printErrorsps


zTextTestResult.printErrorscCsb|D],\}}|j�|j�|j�d||�|�f�|j�|j�|j�d|�|j��qdS)Nz%s: %sz%s)rr�
separator1r%�
separator2r')rZflavourrAr$r3r	r	r
r@ws�zTextTestResult.printErrorList)rrrrrErFrr%r&r,r1r7r9r=r?rDr@�
__classcell__r	r	r r
rs						rc@s8eZdZdZeZ		d
dd�dd�Zd	d
�Zdd�ZdS)�TextTestRunnerz�A test runner class that displays results in textual form.

    It prints out the names of tests as they are run, errors as they
    occur, and a summary of the results at the end of the test run.
    NTrF)�	tb_localsc	CsR|durtj}t|�|_||_||_||_||_||_||_	|dur'||_
dSdS)z�Construct a TextTestRunner.

        Subclasses should accept **kwargs to ensure compatibility as the
        interface changes.
        N)�sys�stderrrrrr�failfast�bufferrI�warnings�resultclass)	rrrrrLrMrOrNrIr	r	r
r�s

�zTextTestRunner.__init__cCs|�|j|j|j�Sr)rOrrrrCr	r	r
�_makeResult�szTextTestRunner._makeResultcCs^|��}t|�|j|_|j|_|j|_t���V|jr/t�|j�|jdvr/tjdt	dd�t
��}t|dd�}|dur@|�z||�Wt|dd�}|durS|�nt|dd�}|durb|�wwt
��}Wd�n1sqwY||}|�
�t|d�r�|j�|j�|j}|j�d	||d
kr�dp�d|f�|j��d
}	}
}z
tt|j|j|jf�}Wn	ty�Ynw|\}	}
}g}
|��s�|j�d�t|j�t|j�}}|r�|
�d|�|r�|
�d|�n|j�d�|r�|
�d|�|	�r|
�d|	�|
�r|
�d|
�|
�r"|j�dd�|
�f�n|j�d�|j��|S)z&Run the given test case or test suite.)�default�always�modulezPlease use assert\w+ instead.)�category�message�startTestRunN�stopTestRunrFzRan %d test%s in %.3fsrr8�rZFAILEDzfailures=%dz	errors=%dZOKz
skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r) rPrrLrMrIrN�catch_warnings�simplefilter�filterwarnings�DeprecationWarning�time�perf_counterrrD�hasattrrrrFZtestsRun�map�lenZexpectedFailures�unexpectedSuccesses�skippedr
Z
wasSuccessfulrrBrA�appendr"r')rr$rZ	startTimerVrWZstopTimeZ	timeTaken�runZ
expectedFailsrbrcZresultsZinfosZfailedZerroredr	r	r
re�s�

�
���
�
�

��
�
zTextTestRunner.run)NTrFFNN)	rrrrrrOrrPrer	r	r	r
rH�s��rH)rrJr]rNrXrZsignalsrZ
__unittest�objectrZ
TestResultrrHr	r	r	r
�<module>sc

?>