OwlCyberSecurity - MANAGER
Edit File: result.cpython-38.pyc
U ����e5d����������������������@���s\���d�Z�ddlZddlZddlZddlmZ�ddlmZ�dZdd��Z d Z d ZG�dd��de�Z dS�) zTest result object�����N����)�util��wrapsTc��������������������s���t������fdd��}|S�)Nc��������������������s$���t�|�dd�r|�������|�f|�|�S�)N�failfastF)�getattr�stop)�self�args�kw��method���'/usr/lib64/python3.8/unittest/result.py�inner ���s����zfailfast.<locals>.innerr���)r ���r���r���r���r���r������s����r���z Stdout: %sz Stderr: %sc�������������������@���s����e�Zd�ZdZdZdZdZd.dd�Zdd��Zdd ��Z d d��Z dd ��Zdd��Zdd��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. NFc�����������������C���sb���d|�_�g�|�_g�|�_d|�_g�|�_g�|�_g�|�_d|�_d|�_d|�_ d�|�_ d�|�_tj |�_tj|�_d|�_d�S�)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 ����streamZdescriptions� verbosityr���r���r����__init__&���s����zTestResult.__init__c�����������������C���s���dS�)z#Called by TestRunner after test runNr����r ���r���r���r����printErrors7���s����zTestResult.printErrorsc�����������������C���s ���|��j�d7��_�d|�_|�����dS�)z-Called when the given test is about to be runr���FN)r���r"����_setupStdout�r ����testr���r���r���� startTest:���s����zTestResult.startTestc�����������������C���s8���|�j�r4|�jd�kr$t���|�_t���|�_|�jt_|�jt_d�S�)N)r���r����io�StringIOr���r���r���r ���r&���r���r���r���r(���@���s���� zTestResult._setupStdoutc�����������������C���s���dS�)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr���r&���r���r���r����startTestRunH���s����zTestResult.startTestRunc�����������������C���s���|������d|�_dS�)z'Called when the given test has been runFN)�_restoreStdoutr"���r)���r���r���r����stopTestN���s����zTestResult.stopTestc�����������������C���s����|�j�r�|�jrltj���}tj���}|rF|�d�s6|d7�}|�j�t |���|rl|�d�s\|d7�}|�j �t|���|�jt_|�j t_|�j� d��|�j����|�j� d��|�j����d�S�)N� r���)r���r"���r���r����getvaluer ����endswithr����write�STDOUT_LINEr!����STDERR_LINEr����seek�truncater���)r ����output�errorr���r���r���r/���S���s$���� zTestResult._restoreStdoutc�����������������C���s���dS�)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr���r&���r���r���r����stopTestRunh���s����zTestResult.stopTestRunc�����������������C���s"���|�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"����r ���r*����errr���r���r����addErrorn���s����zTestResult.addErrorc�����������������C���s"���|�j��||��||�f��d|�_dS�)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)r���r<���r=���r"���r>���r���r���r���� addFailurev���s����zTestResult.addFailurec�����������������C���sZ���|dk rVt�|�dd�r|�����t|d�|j�r4|�j}n|�j}|�||��||�f��d|�_dS�)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(). Nr���Fr���T) r���r���� issubclass�failureExceptionr���r���r<���r=���r"���)r ���r*���Zsubtestr?���r���r���r���r���� addSubTest}���s����zTestResult.addSubTestc�����������������C���s���dS�)z-Called when a test has completed successfullyNr���r)���r���r���r���� addSuccess����s����zTestResult.addSuccessc�����������������C���s���|�j��||f��dS�)zCalled when a test is skipped.N)r���r<���)r ���r*����reasonr���r���r����addSkip����s����zTestResult.addSkipc�����������������C���s���|�j��||��||�f��dS�)z/Called when an expected failure/error occurred.N)r���r<���r=���r>���r���r���r����addExpectedFailure����s�����zTestResult.addExpectedFailurec�����������������C���s���|�j��|��dS�)z5Called when a test was expected to fail, but succeed.N)r���r<���r)���r���r���r����addUnexpectedSuccess����s����zTestResult.addUnexpectedSuccessc�����������������C���s>���t�|�j�t�|�j���kodkn��o<t|�d��p<t�|�j�dkS�)z/Tells whether or not this result was a success.r���r���)�lenr���r����hasattrr���r&���r���r���r���� wasSuccessful����s����$�zTestResult.wasSuccessfulc�����������������C���s ���d|�_�dS�)z+Indicates that the tests should be aborted.TN)r���r&���r���r���r���r�������s����zTestResult.stopc�����������������C���s����|\}}}|r |���|�r |j}q ||jkr6|��|�}nd}tj|||||�jd�}t|����}|�j r�t j���} t j ���} | r�| �d�s�| d7�} |�t| ���| r�| �d�s�| d7�} |�t| ���d�|�S�)z>Converts a sys.exc_info()-style tuple of values into a string.N)�limit�capture_localsr1�����)�_is_relevant_tb_level�tb_nextrC����_count_relevant_tb_levels� traceback�TracebackExceptionr����list�formatr���r���r���r2���r ���r3���r<���r5���r6����join)r ���r?���r*����exctype�value�tb�lengthZtb_eZmsgLinesr9���r:���r���r���r���r=�������s4���� ����� zTestResult._exc_info_to_stringc�����������������C���s���d|j�jkS�)N� __unittest)�tb_frame� f_globals)r ���rZ���r���r���r���rP�������s����z TestResult._is_relevant_tb_levelc�����������������C���s&���d}|r"|���|�s"|d7�}|j}q|S�)Nr���r���)rP���rQ���)r ���rZ���r[���r���r���r���rR�������s ����z$TestResult._count_relevant_tb_levelsc�����������������C���s&���dt��|�j�|�jt|�j�t|�j�f�S�)Nz!<%s run=%i errors=%i failures=%i>)r���Zstrclass� __class__r���rJ���r���r���r&���r���r���r����__repr__����s ������zTestResult.__repr__)NNN)�__name__� __module__�__qualname__�__doc__Z_previousTestClassZ_testRunEnteredZ_moduleSetUpFailedr%���r'���r+���r(���r.���r0���r/���r;���r���r@���rA���rD���rE���rG���rH���rI���rL���r���r=���rP���rR���r`���r���r���r���r���r������s8��� r���)rd���r,���r���rS���rO���r���� functoolsr���r\���r���r5���r6����objectr���r���r���r���r����<module>���s���