Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/unittest/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/unittest/test/__pycache__/test_result.cpython-34.pyc

�
j f�Z�@s@ddlZddlZddlZddlmZddlZddlZGdd�dej�Ze	ej
j�Zx!ddddfD]
Z
ee
=q�Wdddd	d�Zeed<ed
efe�ZGdd�dej�ZGd
d�de�Zdd�ZGdd�dej�Zedkr<ej�ndS)�N)�supportc@sxeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zejejjdkd�dd��Zejejjdkd�dd ��Zejejjdkd�d!d"��Zejejjdkd�d#d$��Zd%d&�Zd'd(�Zd)d*�Zd+S),�Test_TestResultcCs�tj�}|j|j��|jt|j�d�|jt|j�d�|j|jd�|j|j	d�|j
|j�|j
|j�dS)NrF)
�unittest�
TestResult�
assertTrue�
wasSuccessful�assertEqual�len�errors�failures�testsRun�
shouldStopZassertIsNoneZ_stdout_bufferZ_stderr_buffer)�self�result�r�>/opt/alt/python34/lib64/python3.4/unittest/test/test_result.py�	test_initszTest_TestResult.test_initcCs-tj�}|j�|j|jd�dS)NT)rr�stoprr
)rrrrr�	test_stop#s
zTest_TestResult.test_stopcCs�Gdd�dtj�}|d�}tj�}|j|�|j|j��|jt|j�d�|jt|j	�d�|j|j
d�|j|jd�|j|�dS)Nc@seZdZdd�ZdS)z+Test_TestResult.test_startTest.<locals>.FoocSsdS)Nr)rrrr�test_1.sz2Test_TestResult.test_startTest.<locals>.Foo.test_1N)�__name__�
__module__�__qualname__rrrrr�Foo-srrr�F)
r�TestCaser�	startTestrrrr	r
rrr
�stopTest)rr�testrrrr�test_startTest,s
zTest_TestResult.test_startTestcCs%Gdd�dtj�}|d�}tj�}|j|�|j|j��|jt|j�d�|jt|j	�d�|j|j
d�|j|jd�|j|�|j|j��|jt|j�d�|jt|j	�d�|j|j
d�|j|jd�dS)Nc@seZdZdd�ZdS)z*Test_TestResult.test_stopTest.<locals>.FoocSsdS)Nr)rrrrrCsz1Test_TestResult.test_stopTest.<locals>.Foo.test_1N)rrrrrrrrrBsrrrrF)
rrrrrrrr	r
rrr
r)rrrrrrr�
test_stopTestAs

zTest_TestResult.test_stopTestcCs$tj�}|j�|j�dS)N)rrZstartTestRunZstopTestRun)rrrrr�test_startTestRun_stopTestRun\s
z-Test_TestResult.test_startTestRun_stopTestRuncCs�Gdd�dtj�}|d�}tj�}|j|�|j|�|j|�|j|j��|jt	|j
�d�|jt	|j�d�|j|jd�|j|j
d�dS)Nc@seZdZdd�ZdS)z,Test_TestResult.test_addSuccess.<locals>.FoocSsdS)Nr)rrrrrvsz3Test_TestResult.test_addSuccess.<locals>.Foo.test_1N)rrrrrrrrrusrrrrF)rrrr�
addSuccessrrrrr	r
rrr
)rrrrrrr�test_addSuccessts


zTest_TestResult.test_addSuccessc	Cs%Gdd�dtj�}|d�}y|jd�Wntj�}YnXtj�}|j|�|j||�|j|�|j	|j
��|jt|j
�d�|jt|j�d�|j|jd�|j|jd�|jd\}}|j||�|j|t�dS)Nc@seZdZdd�ZdS)z,Test_TestResult.test_addFailure.<locals>.FoocSsdS)Nr)rrrrr�sz3Test_TestResult.test_addFailure.<locals>.Foo.test_1N)rrrrrrrrr�srr�foorrF)rr�fail�sys�exc_inforr�
addFailurer�assertFalserrr	r
rrr
�assertIs�assertIsInstance�str)rrr�exc_info_tupler�	test_case�
formatted_excrrr�test_addFailure�s$

zTest_TestResult.test_addFailurec	Cs!Gdd�dtj�}|d�}y
t��Wntj�}YnXtj�}|j|�|j||�|j|�|j	|j
��|jt|j
�d�|jt|j�d�|j|jd�|j|jd�|j
d\}}|j||�|j|t�dS)Nc@seZdZdd�ZdS)z*Test_TestResult.test_addError.<locals>.FoocSsdS)Nr)rrrrr�sz1Test_TestResult.test_addError.<locals>.Foo.test_1N)rrrrrrrrr�srrrrF)rr�	TypeErrorr&r'rr�addErrorrr)rrr	r
rrr
r*r+r,)rrrr-rr.r/rrr�
test_addError�s$


zTest_TestResult.test_addErrorcs%G���fdd�dtj�}d�|d��tj���j��|j�j��|jt�j�d�|jt�j	�d�|j�j
d�|j�jd��jd\}}|j|��|j
d|��j	d\}}|j|��|j
d|�dS)	Ncs(eZdZ���fdd�ZdS)z,Test_TestResult.test_addSubTest.<locals>.Foocss|jdd��[|j�yddWntk
rHtj�}YnX�j��|�|jd�WdQXdS)Nr$rrzsome recognizable failure)�subTest�_subtest�ZeroDivisionErrorr&r'Z
addSubTestr%)rr-)r�subtestrrrr�s	
z3Test_TestResult.test_addSubTest.<locals>.Foo.test_1N)rrrrr)rr7rrrr�srrrFrr6zsome recognizable failure)rrr�runr)rrr	r
rrr
r*ZassertIn)rrr.r/r)rr7rr�test_addSubTest�s %
zTest_TestResult.test_addSubTestcCs:tjddd�}|j|j|�dtd�dS)NTrz$testGetDescriptionWithoutDocstring (z.Test_TestResult))r�TextTestResultr�getDescriptionr)rrrrr�"testGetDescriptionWithoutDocstrings
z2Test_TestResult.testGetDescriptionWithoutDocstringcCs�|jdddd��>tjddd�}|j|j|j�dtd�WdQX|jd��>tjddd�}|j|j|j�dtd	�WdQXdS)
Nr$r�bar�Tz+testGetSubTestDescriptionWithoutDocstring (z .Test_TestResult) (bar=2, foo=1)zsome messagez .Test_TestResult) [some message])r4rr:rr;r5r)rrrrr�)testGetSubTestDescriptionWithoutDocstringsz9Test_TestResult.testGetSubTestDescriptionWithoutDocstringcCsP|j��>tjddd�}|j|j|j�dtd�WdQXdS)NTrz4testGetSubTestDescriptionWithoutDocstringAndParams (z.Test_TestResult) (<subtest>))r4rr:rr;r5r)rrrrr�2testGetSubTestDescriptionWithoutDocstringAndParamss

zBTest_TestResult.testGetSubTestDescriptionWithoutDocstringAndParamscCso|jdd��W|jdd��>tjddd�}|j|j|j�dtd�WdQXWdQXdS)Nr$rr=r>Tz1testGetNestedSubTestDescriptionWithoutDocstring (z .Test_TestResult) (bar=2, foo=1))r4rr:rr;r5r)rrrrr�/testGetNestedSubTestDescriptionWithoutDocstring%sz?Test_TestResult.testGetNestedSubTestDescriptionWithoutDocstringr>z)Docstrings are omitted with -O2 and abovecCs:tjddd�}|j|j|�dtd�dS)z5Tests getDescription() for a method with a docstring.NTrz(testGetDescriptionWithOneLineDocstring (zG.Test_TestResult)
Tests getDescription() for a method with a docstring.)rr:rr;r)rrrrr�&testGetDescriptionWithOneLineDocstring.sz6Test_TestResult.testGetDescriptionWithOneLineDocstringcCs\tjddd�}|jdddd��)|j|j|j�dtd�WdQXdS)	z5Tests getDescription() for a method with a docstring.NTrr$r=r>z/testGetSubTestDescriptionWithOneLineDocstring (zV.Test_TestResult) (bar=2, foo=1)
Tests getDescription() for a method with a docstring.)rr:r4rr;r5r)rrrrr�-testGetSubTestDescriptionWithOneLineDocstring9s
z=Test_TestResult.testGetSubTestDescriptionWithOneLineDocstringcCs:tjddd�}|j|j|�dtd�dS)zoTests getDescription() for a method with a longer docstring.
        The second line of the docstring.
        NTrz*testGetDescriptionWithMultiLineDocstring (zN.Test_TestResult)
Tests getDescription() for a method with a longer docstring.)rr:rr;r)rrrrr�(testGetDescriptionWithMultiLineDocstringEsz8Test_TestResult.testGetDescriptionWithMultiLineDocstringcCs\tjddd�}|jdddd��)|j|j|j�dtd�WdQXdS)	zoTests getDescription() for a method with a longer docstring.
        The second line of the docstring.
        NTrr$r=r>z1testGetSubTestDescriptionWithMultiLineDocstring (z].Test_TestResult) (bar=2, foo=1)
Tests getDescription() for a method with a longer docstring.)rr:r4rr;r5r)rrrrr�/testGetSubTestDescriptionWithMultiLineDocstringSs
z?Test_TestResult.testGetSubTestDescriptionWithMultiLineDocstringcCsbGdd�dt�}tj�}|j|j|��d|jjd<|j|j|��dS)Nc@s&eZdZGdd�de�ZdS)z5Test_TestResult.testStackFrameTrimming.<locals>.Framec@seZdZiZdS)z>Test_TestResult.testStackFrameTrimming.<locals>.Frame.tb_frameN)rrr�	f_globalsrrrr�tb_framedsrGN)rrr�objectrGrrrr�FramecsrITZ
__unittest)rHrrr)Z_is_relevant_tb_levelrGrFr)rrIrrrr�testStackFrameTrimmingbs
z&Test_TestResult.testStackFrameTrimmingcCs�tj�}dd�|_d|_|jdd�|j|j�tj�}dd�|_d|_|jdd�|j|j�tj�}dd�|_d|_|jd�|j|j�dS)NcWsdS)N�r)�_rrr�<lambda>nsz.Test_TestResult.testFailFast.<locals>.<lambda>TcWsdS)NrKr)rLrrrrMtscWsdS)NrKr)rLrrrrMzs)	rrZ_exc_info_to_string�failfastr2rr
r(�addUnexpectedSuccess)rrrrr�testFailFastls			
zTest_TestResult.testFailFastcsCtjdtj�dd�}�fdd�}|j|�}dS)N�streamrNTcs�j|j�dS)N)rrN)r)rrrr�sz5Test_TestResult.testFailFastSetByRunner.<locals>.test)r�TextTestRunner�io�StringIOr8)r�runnerrrr)rr�testFailFastSetByRunnersz'Test_TestResult.testFailFastSetByRunnerN)rrrrrrr r!r#r0r3r9r<r?r@rArZskipIfr&�flags�optimizerBrCrDrErJrPrVrrrrrs0
	'0"	


rZaddSkipZaddExpectedFailurerO�__init__cCs1g|_g|_d|_d|_d|_dS)NrF)rr
rr
�buffer)rrQZdescriptions�	verbosityrrrrY�s
				�	OldResultc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�Test_OldTestResultc
CsOtjdtf��4t�}|j|�|jt|j�|�WdQXdS)NzTestResult has no add.+ method,)rZcheck_warnings�RuntimeWarningr\r8rr	r)rrrrrrr�assertOldResultWarning�s
	
	
z)Test_OldTestResult.assertOldResultWarningcCsWGdd�dtj�}x7dD]/\}}||�}|j|t|��q WdS)Nc@sFeZdZdd�Zejdd��Zejdd��ZdS)z2Test_OldTestResult.testOldTestResult.<locals>.TestcSs|jd�dS)NZfoobar)�skipTest)rrrr�testSkip�sz;Test_OldTestResult.testOldTestResult.<locals>.Test.testSkipcSs
t�dS)N)r1)rrrr�testExpectedFail�szCTest_OldTestResult.testOldTestResult.<locals>.Test.testExpectedFailcSsdS)Nr)rrrr�testUnexpectedSuccess�szHTest_OldTestResult.testOldTestResult.<locals>.Test.testUnexpectedSuccessN)rrrrarZexpectedFailurerbrcrrrr�Test�srdraTrbrcF�ztestSkipT�ztestExpectedFailT�ztestUnexpectedSuccessF)rerfrg)rrr_�int)rrdZ	test_nameZshould_passrrrr�testOldTestResult�s
z$Test_OldTestResult.testOldTestResultcCs3Gdd�dtj�}|j|d�d�dS)Nc@s(eZdZdd�Zdd�ZdS)z7Test_OldTestResult.testOldTestTesultSetup.<locals>.TestcSs|jd�dS)Nz	no reason)r`)rrrr�setUp�sz=Test_OldTestResult.testOldTestTesultSetup.<locals>.Test.setUpcSsdS)Nr)rrrr�testFoo�sz?Test_OldTestResult.testOldTestTesultSetup.<locals>.Test.testFooN)rrrrjrkrrrrrd�srdrkr)rrr_)rrdrrr�testOldTestTesultSetup�sz)Test_OldTestResult.testOldTestTesultSetupcCsBtjd�Gdd�dtj��}|j|d�d�dS)Nz	no reasonc@seZdZdd�ZdS)z7Test_OldTestResult.testOldTestResultClass.<locals>.TestcSsdS)Nr)rrrrrk�sz?Test_OldTestResult.testOldTestResultClass.<locals>.Test.testFooN)rrrrkrrrrrd�srdrkr)r�skiprr_)rrdrrr�testOldTestResultClass�sz)Test_OldTestResult.testOldTestResultClasscCsNGdd�dtj�}tjdtdtj��}|j|d��dS)Nc@seZdZdd�ZdS)z8Test_OldTestResult.testOldResultWithRunner.<locals>.TestcSsdS)Nr)rrrrrk�sz@Test_OldTestResult.testOldResultWithRunner.<locals>.Test.testFooN)rrrrkrrrrrd�srdZresultclassrQrk)rrrRr\rSrTr8)rrdrUrrr�testOldResultWithRunner�sz*Test_OldTestResult.testOldResultWithRunnerN)rrrr_rirlrnrorrrrr]�s
r]c@s"eZdZedd��ZdS)�
MockTracebackcGsdgS)NzA tracebackr)rLrrr�format_exception�szMockTraceback.format_exceptionN)rrr�staticmethodrqrrrrrp�srpcCsttj_dS)N)�	tracebackrrrrrr�restore_traceback�srtc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�TestOutputBufferingcCstj|_tj|_dS)N)r&�stdout�	_real_out�stderr�	_real_err)rrrrrj�szTestOutputBuffering.setUpcCs|jt_|jt_dS)N)rwr&rvryrx)rrrr�tearDown�szTestOutputBuffering.tearDowncCs�|j}|j}tj�}|j|j�|j|tj�|j|tj	�|j
|�|j|tj�|j|tj	�dS)N)rwryrrr)rZr*r&rvrxr)r�real_out�real_errrrrr�testBufferOutputOff�s		
z'TestOutputBuffering.testBufferOutputOffcCs%|j}|j}tj�}|j|j�d|_|j|tj�|j|tj	�|j
|�|j|tj�|j|tj	�|jtjt
j�|jtj	t
j�|jtjtj	�tj}tj	}t
j�|_t
j�|_td�tddtj	�|j|j�d�|j|j�d�|j|jj�d�|j|jj�d�|j|�|j|�|jtj|j�|jtj	|j�|j|jj�d�|j|jj�d�|j|j�d�|j|j�d�dS)NTr$r=�filezfoo
zbar
rK)rwryrrr)rZr*r&rvrxrZassertIsNotr+rSrT�_original_stdout�_original_stderr�printr�getvaluer"r)rr{r|rZ
out_streamZ
err_streamrrr�#testBufferOutputStartTestAddSuccess�s>			
		


z7TestOutputBuffering.testBufferOutputStartTestAddSuccesscCs&tj�}d|_|j|�|S)NT)rrrZr)rrrrr�getStartedResults	
z$TestOutputBuffering.getStartedResultcCs�ttj_|jt�x{ddddgD]g\}}}|j�}tj}tj	}t
j�|_t
j�|_
tddtj�|r�td	dtj	�nt||�}||d�|j|�t||�}|jt|�d
�|d\}	}
tjd�}d
}|r1tjd�}nd||f}
|j|	|�|j|jj�|�|j|j
j�|�|j|
|
�q,WdS)Nr
r2Trr(Fr$r~r=rrz9
                Stdout:
                foo
            rKz9
                Stderr:
                bar
            zA traceback%s%s)�errors�addErrorT)�failures�
addFailureF)r�r�T)r�r�F)NNN)rprrrs�
addCleanuprtr�r&rvrxrSrTrr�r��getattrrrr	�textwrap�dedentr*r�ZassertMultiLineEqual)rZmessage_attrZadd_attrZ
include_errorrZbuffered_outZbuffered_errZaddFunctionZresult_listr�messageZexpectedOutMessageZexpectedErrMessageZexpectedFullMessagerrr�!testBufferOutputAddErrorOrFailure!s@
		

	z5TestOutputBuffering.testBufferOutputAddErrorOrFailurecCsmtj�}d|_Gdd�dtj�}tj|d�g�}||�|jt|j�d�dS)NTc@s.eZdZedd��Zdd�ZdS)z5TestOutputBuffering.testBufferSetupClass.<locals>.FoocSsdddS)Nrrr)�clsrrr�
setUpClassUsz@TestOutputBuffering.testBufferSetupClass.<locals>.Foo.setUpClasscSsdS)Nr)rrrr�test_fooXsz>TestOutputBuffering.testBufferSetupClass.<locals>.Foo.test_fooN)rrr�classmethodr�r�rrrrrTsrr�r)rrrZr�	TestSuiterr	r
)rrr�suiterrr�testBufferSetupClassPs	
z(TestOutputBuffering.testBufferSetupClasscCsmtj�}d|_Gdd�dtj�}tj|d�g�}||�|jt|j�d�dS)NTc@s.eZdZedd��Zdd�ZdS)z8TestOutputBuffering.testBufferTearDownClass.<locals>.FoocSsdddS)Nrrr)r�rrr�
tearDownClasscszFTestOutputBuffering.testBufferTearDownClass.<locals>.Foo.tearDownClasscSsdS)Nr)rrrrr�fszATestOutputBuffering.testBufferTearDownClass.<locals>.Foo.test_fooN)rrrr�r�r�rrrrrbsrr�r)rrrZrr�rr	r
)rrrr�rrr�testBufferTearDownClass^s	
z+TestOutputBuffering.testBufferTearDownClasscCs�tj�}d|_Gdd�dtj�}Gdd�dt�}d|_|tjd<|jtjj	d�tj
|d�g�}||�|jt|j
�d�dS)NTc@seZdZdd�ZdS)z6TestOutputBuffering.testBufferSetUpModule.<locals>.FoocSsdS)Nr)rrrrr�qsz?TestOutputBuffering.testBufferSetUpModule.<locals>.Foo.test_fooN)rrrr�rrrrrpsrc@s"eZdZedd��ZdS)z9TestOutputBuffering.testBufferSetUpModule.<locals>.ModulecSsdddS)Nrrrrrrr�setUpModuletszETestOutputBuffering.testBufferSetUpModule.<locals>.Module.setUpModuleN)rrrrrr�rrrr�Modulessr�r�r)rrrZrrHrr&�modulesr��popr�rr	r
)rrrr�r�rrr�testBufferSetUpModulels		

z)TestOutputBuffering.testBufferSetUpModulecCs�tj�}d|_Gdd�dtj�}Gdd�dt�}d|_|tjd<|jtjj	d�tj
|d�g�}||�|jt|j
�d�dS)NTc@seZdZdd�ZdS)z9TestOutputBuffering.testBufferTearDownModule.<locals>.FoocSsdS)Nr)rrrrr��szBTestOutputBuffering.testBufferTearDownModule.<locals>.Foo.test_fooN)rrrr�rrrrr�src@s"eZdZedd��ZdS)z<TestOutputBuffering.testBufferTearDownModule.<locals>.ModulecSsdddS)Nrrrrrrr�tearDownModule�szKTestOutputBuffering.testBufferTearDownModule.<locals>.Module.tearDownModuleN)rrrrrr�rrrrr��sr�r�r)rrrZrrHrr&r�r�r�r�rr	r
)rrrr�r�rrr�testBufferTearDownModules		

z,TestOutputBuffering.testBufferTearDownModuleN)
rrrrjrzr}r�r�r�r�r�r�r�rrrrru�s0/ru�__main__)rSr&r�rrrsrrr�dictr�__dict__Z	classDict�mrY�typerHr\r]rprtrur�mainrrrr�<module>s(�|

4�