Your IP : 3.145.152.49


Current Path : /lib64/python3.8/unittest/__pycache__/
Upload File :
Current File : //lib64/python3.8/unittest/__pycache__/runner.cpython-38.pyc

U

e5dW�@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	�'/usr/lib64/python3.8/unittest/runner.py�__init__sz_WritelnDecorator.__init__cCs|dkrt|��t|j|�S)N)r�__getstate__)�AttributeError�getattrr)r�attrr	r	r
�__getattr__sz_WritelnDecorator.__getattr__NcCs|r|�|�|�d�dS�N�
)�write)r�argr	r	r
�writelns
z_WritelnDecorator.writeln)N)�__name__�
__module__�__qualname__�__doc__rrrr	r	r	r
r
srcs�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__cCs0|��}|jr$|r$d�t|�|f�St|�SdSr)ZshortDescriptionr�join�str)r�testZdoc_first_liner	r	r
�getDescription,s
zTextTestResult.getDescriptioncsBtt|��|�|jr>|j�|�|��|j�d�|j��dS)Nz ... )rr�	startTestrrrr%�flush�rr$r r	r
r&3s
zTextTestResult.startTestcsDtt|��|�|jr$|j�d�n|jr@|j�d�|j��dS)N�ok�.)	rr�
addSuccessrrrrrr'r(r r	r
r+:szTextTestResult.addSuccesscsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)N�ERROR�E)	rr�addErrorrrrrrr'�rr$�errr r	r
r.BszTextTestResult.addErrorcsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)N�FAIL�F)	rr�
addFailurerrrrrr'r/r r	r
r3JszTextTestResult.addFailurecsLtt|��||�|jr,|j�d�|��n|jrH|j�d�|j�	�dS)Nz
skipped {0!r}�s)
rr�addSkiprrr�formatrrr')rr$�reasonr r	r
r5RszTextTestResult.addSkipcsFtt|��||�|jr&|j�d�n|jrB|j�d�|j��dS)Nzexpected failure�x)	rr�addExpectedFailurerrrrrr'r/r r	r
r9Zsz!TextTestResult.addExpectedFailurecsDtt|��|�|jr$|j�d�n|jr@|j�d�|j��dS)Nzunexpected success�u)	rr�addUnexpectedSuccessrrrrrr'r(r r	r
r;bsz#TextTestResult.addUnexpectedSuccesscCs6|js|jr|j��|�d|j�|�d|j�dS)Nr,r1)rrrr�printErrorList�errors�failures�rr	r	r
�printErrorsjs
zTextTestResult.printErrorscCsX|D]N\}}|j�|j�|j�d||�|�f�|j�|j�|j�d|�qdS)Nz%s: %sz%s)rr�
separator1r%�
separator2)rZflavourr=r$r0r	r	r
r<ps
zTextTestResult.printErrorList)rrrrrArBrr%r&r+r.r3r5r9r;r@r<�
__classcell__r	r	r r
rsrc@s4eZdZdZeZd
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	CsN|dkrtj}t|�|_||_||_||_||_||_||_	|dk	rJ||_
dS)z�Construct a TextTestRunner.

        Subclasses should accept **kwargs to ensure compatibility as the
        interface changes.
        N)�sys�stderrrrrr�failfast�bufferrE�warnings�resultclass)	rrrrrHrIrKrJrEr	r	r
r�s
zTextTestRunner.__init__cCs|�|j|j|j�Sr)rKrrrr?r	r	r
�_makeResult�szTextTestRunner._makeResultcCs2|��}t|�|j|_|j|_|j|_t����|jr^t�|j�|jdkr^tjdt	dd�t
��}t|dd�}|dk	r�|�z||�W5t|dd�}|dk	r�|�Xt
��}W5QRX||}|�
�t|d�r�|j�|j�|j}|j�d	||d
ko�d�pd|f�|j��d
}	}
}ztt|j|j|jf�}Wntk
�rTYnX|\}	}
}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�|S)z&Run the given test case or test suite.)�default�always�modulezPlease use assert\w+ instead.)�category�message�startTestRunN�stopTestRunrBzRan %d test%s in %.3fsrr4�rZFAILEDzfailures=%dz	errors=%dZOKz
skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r)rLrrHrIrErJ�catch_warnings�simplefilter�filterwarnings�DeprecationWarning�time�perf_counterrr@�hasattrrrrBZtestsRun�map�lenZexpectedFailures�unexpectedSuccesses�skippedr
Z
wasSuccessfulrr>r=�appendr")rr$rZ	startTimerRrSZstopTimeZ	timeTaken�runZ
expectedFailsr^r_ZresultsZinfosZfailedZerroredr	r	r
ra�sx

�
�
�


zTextTestRunner.run)NTrFFNN)	rrrrrrKrrLrar	r	r	r
rDxs��rD)rrFrYrJrTrZsignalsrZ
__unittest�objectrZ
TestResultrrDr	r	r	r
�<module>s[

?>