Your IP : 18.191.218.234


Current Path : /opt/alt/python34/lib64/python3.4/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/unittest/__pycache__/result.cpython-34.pyo

�
j f��@s�dZddlZddlZddlZddlmZddlmZdZdd�Z	d	Z
d
ZGdd�de�Z
dS)
zTest result object�N�)�util)�wrapsTcs"t���fdd��}|S)Ncs/t|dd�r|j�n�|||�S)N�failfastF)�getattr�stop)�self�args�kw)�method��4/opt/alt/python34/lib64/python3.4/unittest/result.py�inner
s
zfailfast.<locals>.inner)r)rrr)rr
rsrz
Stdout:
%sz
Stderr:
%sc@s?eZdZdZdZdZdZddddd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zedd��Zedd��Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�ZdS).�
TestResulta�Holder for test result information.

    Test results are automatically managed by the TestCase and TestSuite
    classes, and do not need to be explicitly manipulated by writers of tests.

    Each instance holds the total number of tests run, and collections of
    failures and errors that occurred among those test runs. The collections
    contain tuples of (testcase, exceptioninfo), where exceptioninfo is the
    formatted traceback of the error that occurred.
    NFcCs�d|_g|_g|_d|_g|_g|_g|_d|_d|_d|_	d|_
tj|_
tj|_d|_dS)NFr)r�failures�errors�testsRun�skipped�expectedFailures�unexpectedSuccesses�
shouldStop�buffer�_stdout_buffer�_stderr_buffer�sys�stdout�_original_stdout�stderr�_original_stderr�
_mirrorOutput)r�streamZdescriptions�	verbosityrrr
�__init__&s											zTestResult.__init__cCsdS)z#Called by TestRunner after test runNr)rrrr
�printErrors6szTestResult.printErrorscCs&|jd7_d|_|j�dS)z-Called when the given test is about to be runrFN)rr�_setupStdout)r�testrrr
�	startTest9s	zTestResult.startTestcCsX|jrT|jdkr9tj�|_tj�|_n|jt_|jt_ndS)N)rr�io�StringIOrrrr)rrrr
r$?s	zTestResult._setupStdoutcCsdS)zpCalled once before any tests are executed.

        See startTest for a method called before each test.
        Nr)rrrr
�startTestRunGszTestResult.startTestRuncCs|j�d|_dS)z'Called when the given test has been runFN)�_restoreStdoutr)rr%rrr
�stopTestMs
zTestResult.stopTestcCs�|jr�|jr�tjj�}tjj�}|ri|jd�sR|d7}n|jjt	|�n|r�|jd�s�|d7}n|j
jt|�q�n|jt_|j
t_|jj
d�|jj�|jj
d�|jj�ndS)N�
r)rrrr�getvaluer�endswithr�write�STDOUT_LINEr�STDERR_LINEr�seek�truncater)r�output�errorrrr
r*Rs$		


zTestResult._restoreStdoutcCsdS)zmCalled once after all tests are executed.

        See stopTest for a method called after each test.
        Nr)rrrr
�stopTestRungszTestResult.stopTestRuncCs/|jj||j||�f�d|_dS)zmCalled when an error has occurred. 'err' is a tuple of values as
        returned by sys.exc_info().
        TN)r�append�_exc_info_to_stringr)rr%�errrrr
�addErrorms"zTestResult.addErrorcCs/|jj||j||�f�d|_dS)zdCalled when an error has occurred. 'err' is a tuple of values as
        returned by sys.exc_info().TN)rr7r8r)rr%r9rrr
�
addFailureus"zTestResult.addFailurecCs�|dk	r�t|dd�r+|j�nt|d|j�rM|j}n	|j}|j||j||�f�d|_ndS)z�Called at the end of a subtest.
        'err' is None if the subtest ended successfully, otherwise it's a
        tuple of values as returned by sys.exc_info().
        NrFrT)	rr�
issubclass�failureExceptionrrr7r8r)rr%Zsubtestr9rrrr
�
addSubTest|s
	zTestResult.addSubTestcCsdS)z-Called when a test has completed successfullyNr)rr%rrr
�
addSuccess�szTestResult.addSuccesscCs|jj||f�dS)zCalled when a test is skipped.N)rr7)rr%�reasonrrr
�addSkip�szTestResult.addSkipcCs&|jj||j||�f�dS)z.Called when an expected failure/error occured.N)rr7r8)rr%r9rrr
�addExpectedFailure�s	zTestResult.addExpectedFailurecCs|jj|�dS)z5Called when a test was expected to fail, but succeed.N)rr7)rr%rrr
�addUnexpectedSuccess�szTestResult.addUnexpectedSuccesscCsQt|j�t|j�ko)dknoPt|d�pPt|j�dkS)z/Tells whether or not this result was a success.rr)�lenrr�hasattrr)rrrr
�
wasSuccessful�s.zTestResult.wasSuccessfulcCs
d|_dS)z+Indicates that the tests should be aborted.TN)r)rrrr
r�szTestResult.stopc
Cs%|\}}}x"|r3|j|�r3|j}qW||jkrm|j|�}tj||||�}ntj|||�}|jrtjj	�}tj
j	�}	|r�|jd�s�|d7}n|jt
|�n|	r|	jd�s|	d7}	n|jt|	�qndj|�S)z>Converts a sys.exc_info()-style tuple of values into a string.r,�)�_is_relevant_tb_level�tb_nextr=�_count_relevant_tb_levels�	traceback�format_exceptionrrrr-rr.r7r0r1�join)
rr9r%�exctype�value�tb�lengthZmsgLinesr4r5rrr
r8�s&
	

zTestResult._exc_info_to_stringcCsd|jjkS)N�
__unittest)�tb_frame�	f_globals)rrPrrr
rH�sz TestResult._is_relevant_tb_levelcCs:d}x-|r5|j|�r5|d7}|j}q	W|S)Nrr)rHrI)rrPrQrrr
rJ�s


z$TestResult._count_relevant_tb_levelscCs5dtj|j�|jt|j�t|j�fS)Nz!<%s run=%i errors=%i failures=%i>)rZstrclass�	__class__rrDrr)rrrr
�__repr__�s!zTestResult.__repr__)�__name__�
__module__�__qualname__�__doc__Z_previousTestClassZ_testRunEnteredZ_moduleSetUpFailedr"r#r&r$r)r+r*r6rr:r;r>r?rArBrCrFrr8rHrJrVrrrr
rs2
	r)rZr'rrKrGr�	functoolsrrRrr0r1�objectrrrrr
�<module>s

?>