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_case.cpython-34.pyc

�
j f��@s[ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlZddlmZmZmZmZmZddlmZejd�Zejd�Zejd�ZGd	d
�d
e�ZGdd�dejee�Zed
krWej �ndS)�N)�deepcopy)�support)�TestEquality�TestHashing�
LoggingResult�LegacyLoggingResult�#ResultWithNoStartTestRunStopTestRun)�captured_stderr�foozfoo.bar�quuxc@s^eZdZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)	�Testz5Keep these TestCase classes out of the main namespacec@s(eZdZdd�Zdd�ZdS)zTest.FoocCsdS)N�)�selfr
r
�</opt/alt/python34/lib64/python3.4/unittest/test/test_case.py�runTest!szTest.Foo.runTestcCsdS)Nr
)rr
r
r�test1"szTest.Foo.test1N)�__name__�
__module__�__qualname__rrr
r
r
r�Foo src@seZdZdd�ZdS)zTest.BarcCsdS)Nr
)rr
r
r�test2%szTest.Bar.test2N)rrrrr
r
r
r�Bar$srcsLeZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�S)
zTest.LoggingTestCasez!A test case which logs its calls.cs&ttj|�jd�||_dS)N�test)�superr�LoggingTestCase�__init__�events)rr)�	__class__r
rr*szTest.LoggingTestCase.__init__cCs|jjd�dS)N�setUp)r�append)rr
r
rr.szTest.LoggingTestCase.setUpcCs|jjd�dS)Nr)rr)rr
r
rr1szTest.LoggingTestCase.testcCs|jjd�dS)N�tearDown)rr)rr
r
rr 4szTest.LoggingTestCase.tearDown)rrr�__doc__rrrr r
r
)rrr's
rN)	rrrr!�unittest�TestCaserrrr
r
r
rrsrc@s�eZdZejd�ejd�fgZejd�ejd�fejd�ejd�fejd�ejd�fgZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'e(j)e*j+j,dDkdE�dFdG��Z-e(j)e*j+j,dDkdE�dHdI��Z.dJdK�Z/dLdM�Z0dNdO�Z1dPdQ�Z2dRdS�Z3dTdU�Z4dVdW�Z5dXdY�Z6dZd[�Z7d\d]�Z8d^d_�Z9d`da�Z:dbdc�Z;ddde�Z<dfdg�Z=dhdi�Z>djdk�Z?dldm�Z@dndo�ZAdpdq�ZBdrds�ZCdtdu�ZDdvdw�ZEdxdy�ZFdzd{�ZGd|d}�ZHd~d�ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPeQjRd�d���ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdeejfd�d���Zgd�d��Zhd�S)��
Test_TestCaserrrcCs�Gdd�dtj�}|j|�j�dd�d�tj�}|jdd�|j|j��|jdd�WdQX|jt��|j�WdQXdS)Nc@s(eZdZdd�Zdd�ZdS)z3Test_TestCase.test_init__no_test_name.<locals>.TestcSs
t��dS)N)�MyException)rr
r
rrTsz;Test_TestCase.test_init__no_test_name.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrUsz8Test_TestCase.test_init__no_test_name.<locals>.Test.testN)rrrrrr
r
r
rrSsr�
z
.Test.runTest��i�)r"r#�assertEqual�id�assertRaises�failureException�AttributeError�run)rrrr
r
r�test_init__no_test_nameRs#z%Test_TestCase.test_init__no_test_namecCsCGdd�dtj�}|j|d�j�dd�d�dS)Nc@s(eZdZdd�Zdd�ZdS)z7Test_TestCase.test_init__test_name__valid.<locals>.TestcSs
t��dS)N)r%)rr
r
rrisz?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrjsz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testN)rrrrrr
r
r
rrhsrr�
z
.Test.testi����)r"r#r)r*)rrr
r
r�test_init__test_name__validgsz)Test_TestCase.test_init__test_name__validcCsMGdd�dtj�}y|d�Wntk
r;YnX|jd�dS)Nc@s(eZdZdd�Zdd�ZdS)z9Test_TestCase.test_init__test_name__invalid.<locals>.TestcSs
t��dS)N)r%)rr
r
rrtszATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrusz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testN)rrrrrr
r
r
rrssrZtestfoozFailed to raise ValueError)r"r#�
ValueError�fail)rrr
r
r�test_init__test_name__invalidrs
z+Test_TestCase.test_init__test_name__invalidcCs9Gdd�dtj�}|j|d�j�d�dS)Nc@seZdZdd�ZdS)z.Test_TestCase.test_countTestCases.<locals>.FoocSsdS)Nr
)rr
r
rr�sz3Test_TestCase.test_countTestCases.<locals>.Foo.testN)rrrrr
r
r
rr�srr�)r"r#r)ZcountTestCases)rrr
r
r�test_countTestCases�sz!Test_TestCase.test_countTestCasescCsEGdd�dtj�}|�j�}|jt|�tj�dS)Nc@seZdZdd�ZdS)z1Test_TestCase.test_defaultTestResult.<locals>.FoocSsdS)Nr
)rr
r
rr�sz9Test_TestCase.test_defaultTestResult.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r"r#�defaultTestResultr)�type�
TestResult)rr�resultr
r
r�test_defaultTestResult�sz$Test_TestCase.test_defaultTestResultcsjg}t|�}G�fdd�dtj���|�j|�ddddg}|j||�dS)Ncs%eZdZ��fdd�Z�S)z>Test_TestCase.test_run_call_order__error_in_setUp.<locals>.Foocs#t�|�j�td��dS)Nzraised by Foo.setUp)rr�RuntimeError)r)rrr
rr�szDTest_TestCase.test_run_call_order__error_in_setUp.<locals>.Foo.setUp)rrrrr
)r)rrr�sr�	startTestr�addError�stopTest)rrrr.r))rrr:�expectedr
)rr�#test_run_call_order__error_in_setUp�sz1Test_TestCase.test_run_call_order__error_in_setUpcsag}G�fdd�dtj���|�j�ddddddg}|j||�dS)	Ncs1eZdZdd�Z��fdd�Z�S)zMTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr7�sz_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcs#t�|�j�td��dS)Nzraised by Foo.setUp)rrr<)r)rrr
rr�szSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrr7rr
)r)rrr�sr�startTestRunr=rr>r?�stopTestRun)rrr.r))rrr@r
)rr�2test_run_call_order__error_in_setUp_default_result�sz@Test_TestCase.test_run_call_order__error_in_setUp_default_resultcspg}t|�}G�fdd�dtj��ddddddg}�|�j|�|j||�dS)	Ncs%eZdZ��fdd�Z�S)z=Test_TestCase.test_run_call_order__error_in_test.<locals>.Foocs#t�|�j�td��dS)Nzraised by Foo.test)rrr<)r)rrr
rr�szBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test)rrrrr
)r)rrr�srr=rrr r>r?)rrrr.r))rrr:r@r
)rr�"test_run_call_order__error_in_test�sz0Test_TestCase.test_run_call_order__error_in_testcsgg}G�fdd�dtj��ddddddd	d
g}�|�j�|j||�dS)Ncs1eZdZdd�Z��fdd�Z�S)zLTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr7�sz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcs#t�|�j�td��dS)Nzraised by Foo.test)rrr<)r)rrr
rr�szQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test)rrrr7rr
)r)rrr�srrBr=rrr r>r?rC)rrr.r))rrr@r
)rr�1test_run_call_order__error_in_test_default_result�sz?Test_TestCase.test_run_call_order__error_in_test_default_resultcspg}t|�}G�fdd�dtj��ddddddg}�|�j|�|j||�dS)	Ncs%eZdZ��fdd�Z�S)z?Test_TestCase.test_run_call_order__failure_in_test.<locals>.Foocs$t�|�j�|jd�dS)Nzraised by Foo.test)rrr3)r)rrr
rr�szDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.test)rrrrr
)r)rrr�srr=rrr �
addFailurer?)rrrr.r))rrr:r@r
)rr�$test_run_call_order__failure_in_test�sz2Test_TestCase.test_run_call_order__failure_in_testcsgG�fdd�dtj��ddddddd	d
g}g}�|�j�|j||�dS)Ncs1eZdZdd�Z��fdd�Z�S)zNTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr7�sz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcs$t�|�j�|jd�dS)Nzraised by Foo.test)rrr3)r)rrr
rr�szSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.test)rrrr7rr
)r)rrr�srrBr=rrr rGr?rC)rrr.r))rr@rr
)rr�3test_run_call_order__failure_in_test_default_result�szATest_TestCase.test_run_call_order__failure_in_test_default_resultcspg}t|�}G�fdd�dtj���|�j|�ddddddg}|j||�dS)	Ncs%eZdZ��fdd�Z�S)zATest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foocs#t�|�j�td��dS)Nzraised by Foo.tearDown)rr r<)r)rrr
rr szJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr r
)r)rrrsrr=rrr r>r?)rrrr.r))rrr:r@r
)rr�&test_run_call_order__error_in_tearDown
s	z4Test_TestCase.test_run_call_order__error_in_tearDowncsgG�fdd�dtj��g}�|�j�ddddddd	d
g}|j||�dS)Ncs1eZdZdd�Z��fdd�Z�S)zPTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr7szbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcs#t�|�j�td��dS)Nzraised by Foo.tearDown)rr r<)r)rrr
rr szYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrr7r r
)r)rrrsrrBr=rrr r>r?rC)rrr.r))rrr@r
)rr�5test_run_call_order__error_in_tearDown_default_resultszCTest_TestCase.test_run_call_order__error_in_tearDown_default_resultcCs-Gdd�dtj�}|d�j�dS)Nc@s(eZdZdd�Zdd�ZdS)z=Test_TestCase.test_run_call_order_default_result.<locals>.FoocSst�S)N)r)rr
r
rr7-szOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSsdS)Nr
)rr
r
rr/szBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrr7rr
r
r
rr,srr)r"r#r.)rrr
r
r�"test_run_call_order_default_result*sz0Test_TestCase.test_run_call_order_default_resultcsFG�fdd�dtj���|�j|�|j||�dS)Ncs%eZdZ��fdd�Z�S)z6Test_TestCase._check_call_order__subtests.<locals>.Foocs�t�|�j�x�dddgD]�}|jd|��p|dkrX|jd�nxLddgD]>}|jd|��$||dkr�td��nWdQXqeWWdQXq#Wdd	dS)
Nr5r(r'�i�failure�j�zraised by Foo.testr)rr�subTestr3r<)rrMrO)rrr
rr6s#z;Test_TestCase._check_call_order__subtests.<locals>.Foo.test)rrrrr
)r)rrr5sr)rrr.r))rr:r�expected_eventsr
)rr�_check_call_order__subtests4sz)Test_TestCase._check_call_order__subtestscCsPg}t|�}dddddddddddg}|j|||�dS)	Nr=rrr �addSubTestFailure�addSubTestSuccessr>r?)rrS)rrr:r@r
r
r�test_run_call_order__subtestsLsz+Test_TestCase.test_run_call_order__subtestscCsAg}t|�}ddddddg}|j|||�dS)Nr=rrr rGr?)rrS)rrr:r@r
r
r�$test_run_call_order__subtests_legacyUs
z2Test_TestCase.test_run_call_order__subtests_legacycsFG�fdd�dtj���|�j|�|j||�dS)Ncs%eZdZ��fdd�Z�S)z>Test_TestCase._check_call_order__subtests_success.<locals>.Foocswt�|�j�x]ddgD]O}|jd|��5x-ddgD]}|jd|��WdQXqFWWdQXq WdS)Nr5r(rMr'rO)rrrQ)rrMrO)rrr
rr`szCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.test)rrrrr
)r)rrr_sr)rrr.r))rr:rrRr
)rr�#_check_call_order__subtests_success^s	z1Test_TestCase._check_call_order__subtests_successcCsPg}t|�}ddddgddgddg}|j|||�dS)	Nr=rrr rPrU�
addSuccessr?)rrX)rrr:r@r
r
r�%test_run_call_order__subtests_successks'z3Test_TestCase.test_run_call_order__subtests_successcCsAg}t|�}ddddddg}|j|||�dS)Nr=rrr rYr?)rrX)rrr:r@r
r
r�,test_run_call_order__subtests_success_legacyus
z:Test_TestCase.test_run_call_order__subtests_success_legacycsyg}t|�}d|_G�fdd�dtj��dddddd	g}�|�j|�|j||�dS)
NTcs%eZdZ��fdd�Z�S)zATest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foocspt�|�j�|jdd��|jd�WdQX|jdd��|jd�WdQX|jd�dS)NrMr5rNr()rrrQr3)r)rrr
rr�szFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.test)rrrrr
)r)rrr�srr=rrr rTr?)r�failfastrrr.r))rrr:r@r
)rr�&test_run_call_order__subtests_failfast}s		z4Test_TestCase.test_run_call_order__subtests_failfastcsyg�G�fdd�dtj�}tj�}d|_tj|�}|j|�dddg}|j�|�dS)NcsFeZdZ�fdd�Z�fdd�Z�fdd�ZdS)z1Test_TestCase.test_subtests_failfast.<locals>.Fooc	s1|j���jd�WdQX�jd�dS)N�a1�a2)rQr)r)rr
r�test_a�s
z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_acsQ|j���jd�WdQX|j��|jd�WdQX�jd�dS)N�b1rNZb2)rQrr3)r)rr
r�test_b�s


z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_bcs�jd�dS)N�c)r)r)rr
r�test_c�sz8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_cN)rrrr`rbrdr
)rr
rr�srTr^r_ra)r"r#r9r\Z	makeSuiter.r))rrr:Zsuiter@r
)rr�test_subtests_failfast�s	
z$Test_TestCase.test_subtests_failfastcCs6Gdd�dtj�}|j|d�jt�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_failureException__default.<locals>.FoocSsdS)Nr
)rr
r
rr�sz>Test_TestCase.test_failureException__default.<locals>.Foo.testN)rrrrr
r
r
rr�srr)r"r#�assertIsr,�AssertionError)rrr
r
r�test_failureException__default�sz,Test_TestCase.test_failureException__defaultcCszg}t|�}Gdd�dtj�}|j|d�jt�|d�j|�dddg}|j||�dS)Nc@s"eZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.FoocSs
t��dS)N)r<)rr
r
rr�szRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN)rrrrr<r,r
r
r
rr�srrr=rGr?)rr"r#rfr,r<r.r))rrr:rr@r
r
r�2test_failureException__subclassing__explicit_raise�sz@Test_TestCase.test_failureException__subclassing__explicit_raisecCszg}t|�}Gdd�dtj�}|j|d�jt�|d�j|�dddg}|j||�dS)Nc@s"eZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.FoocSs|jd�dS)Nr
)r3)rr
r
rr�szRTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.Foo.testN)rrrrr<r,r
r
r
rr�srrr=rGr?)rr"r#rfr,r<r.r))rrr:rr@r
r
r�2test_failureException__subclassing__implicit_raise�sz@Test_TestCase.test_failureException__subclassing__implicit_raisecCs*Gdd�dtj�}|�j�dS)Nc@seZdZdd�ZdS)z%Test_TestCase.test_setUp.<locals>.FoocSsdS)Nr
)rr
r
rr�sz-Test_TestCase.test_setUp.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r"r#r)rrr
r
r�
test_setUp�szTest_TestCase.test_setUpcCs*Gdd�dtj�}|�j�dS)Nc@seZdZdd�ZdS)z(Test_TestCase.test_tearDown.<locals>.FoocSsdS)Nr
)rr
r
rr�sz0Test_TestCase.test_tearDown.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r"r#r )rrr
r
r�
test_tearDown�szTest_TestCase.test_tearDowncCs6Gdd�dtj�}|j|�j�t�dS)Nc@seZdZdd�ZdS)z"Test_TestCase.test_id.<locals>.FoocSsdS)Nr
)rr
r
rrsz*Test_TestCase.test_id.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r"r#�assertIsInstancer*�str)rrr
r
r�test_id�szTest_TestCase.test_idcs�g�t���G��fdd�dtj�}|d�j�}|j|��ddddddg}|j�|�dS)	Ncs4eZdZ�fdd�Z�fdd�ZdS)z;Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foocs�jd�dS)Nr)r)r)rr
rrsz@Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.testcs�S)Nr
)r)�
defaultResultr
rr7szMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrrr7r
)rprr
rrsrrrBr=rYr?rC)rr"r#r.rfr))rrr:r@r
)rprr� test_run__uses_defaultTestResult
s"z.Test_TestCase.test_run__uses_defaultTestResultcCsNGdd�dtj�}tj�}|d�j|�}|j||�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_run__returns_given_result.<locals>.FoocSsdS)Nr
)rr
r
rr"sz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testN)rrrrr
r
r
rr!srr)r"r#r9r.rf)rrr:�retvalr
r
r�test_run__returns_given_resultsz,Test_TestCase.test_run__returns_given_resultcs`tj��tj��G��fdd�dtj�}|d���}|j|��dS)Ncs1eZdZdd�Z��fdd�ZdS)zKTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.FoocSsdS)Nr
)rr
r
rr2szPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|j|���S)N)rf)rr:)�resultIn�	resultOutr
rr.5szOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrrr.r
)rtrur
rr1srr)r"r9r#rf)rrrrr
)rtrur�0test_call__invoking_an_instance_delegates_to_run-s
"z>Test_TestCase.test_call__invoking_an_instance_delegates_to_runcCs|j|j��dS)N)�assertIsNone�shortDescription)rr
r
r�$testShortDescriptionWithoutDocstring>sz2Test_TestCase.testShortDescriptionWithoutDocstringr(z)Docstrings are omitted with -O2 and abovecCs|j|j�d�dS)z7Tests shortDescription() for a method with a docstring.N)r)rx)rr
r
r�(testShortDescriptionWithOneLineDocstringAs	z6Test_TestCase.testShortDescriptionWithOneLineDocstringcCs|j|j�d�dS)z�Tests shortDescription() for a method with a longer docstring.

        This method ensures that only the first line of a docstring is
        returned used in the short description, no matter how long the
        whole thing is.
        z>Tests shortDescription() for a method with a longer docstring.N)r)rx)rr
r
r�*testShortDescriptionWithMultiLineDocstringIs		z8Test_TestCase.testShortDescriptionWithMultiLineDocstringcsuGdd�dt������}}|j||k�d�fdd�}|j�|�|j||�dS)Nc@seZdZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakez)Dummy class for test_addTypeEqualityFunc.N)rrrr!r
r
r
r�SadSnakeXsr|cs$t|�t|�ko!�kSS)N)r8)�a�b�msg)r|r
r�AllSnakesCreatedEqual\szDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqual)�object�assertFalseZaddTypeEqualityFuncr))r�s1�s2r�r
)r|r�testAddTypeEqualityFuncWsz%Test_TestCase.testAddTypeEqualityFunccCs<t�}|j||�|j|j|j|t��dS)N)r�rfr+r,)r�thingr
r
r�testAssertIsds	zTest_TestCase.testAssertIscCs<t�}|j|t��|j|j|j||�dS)N)r�ZassertIsNotr+r,)rr�r
r
r�testAssertIsNotis	zTest_TestCase.testAssertIsNotcCs6g}|j|t�|j|j|j|t�dS)N)rm�listr+r,�dict)rr�r
r
r�testAssertIsInstancensz"Test_TestCase.testAssertIsInstancecCs6g}|j|t�|j|j|j|t�dS)N)ZassertNotIsInstancer�r+r,r�)rr�r
r
r�testAssertNotIsInstancetsz%Test_TestCase.testAssertNotIsInstancecCsKidd6dd6dd6}|jdd�|jd	d
d	dg�|jd|�|jdd�|jd
d
d	dg�|jd|�|j|j|jdd�|j|j|jdd
d	dg�|j|j|jd|�|j|j|jdd�|j|j|jd
d
d	dg�|j|j|jd|�dS)NZbananaZmonkeyZgrassZcowZfishZsealr}�abcr(r5r'�drZotter�x�Zelephantrc)�assertIn�assertNotInr+r,)rZanimalsr
r
r�testAssertInzs%%zTest_TestCase.testAssertInc1Cs0tj��tjdt�|jii�|jiidd6�|jidd6idd6�|jidd6idd6dd6�|jidd6dd6idd6dd6�|j|j��|jidd6i�WdQX|j|j��#|jidd6idd6�WdQX|j|j��#|jidd6idd6�WdQX|j|j��*|jidd6dd6idd6�WdQX|j|j��*|jidd6dd6idd6�WdQXdjd	d
�td�D��}|j|j��#|ji|d6id
d6�WdQXWdQXdS)N�ignorer5r}r(r~�onerc�css|]}t|�VqdS)N)�chr)�.0rMr
r
r�	<genexpr>�sz=Test_TestCase.testAssertDictContainsSubset.<locals>.<genexpr>�r
u�)	�warnings�catch_warnings�simplefilter�DeprecationWarning�assertDictContainsSubsetr+r,�join�range)rr�r
r
r�testAssertDictContainsSubset�s(
%,$$++"z*Test_TestCase.testAssertDictContainsSubsetcCsfffiifggft�t�ft�t�fg}x�|D]�\}}y|j||�Wn,|jk
r�|jd||f�YnXy|j||dd�Wn,|jk
r�|jd||f�YnXy|j||d�WqF|jk
r#|jd||f�YqFXqFWfgfit�ftddg�tddg�ftdd	g�tdd
g�ftd
dg�td	dg�fg}xq|D]i\}}|j|j|j||�|j|j|j||d�|j|j|j||dd�q�WdS)NzassertEqual(%r, %r) failedrr
z$assertEqual(%r, %r) with msg= failedz/assertEqual(%r, %r) with third parameter failedr�r5r(�r')�set�	frozensetr)r,r3r+)rZequal_pairsr}r~Z
unequal_pairsr
r
r�testAssertEqual�s<					!!'zTest_TestCase.testAssertEqualcCs�|jgg�|jff�|jgf�ddgg}g}|jtjj|j||�|jtjj|jt|�t|��|jtjj|j|t|��|j|�|j||�|jt|�t|��|j|t|��|jt|�|�|j|j|j|t|��|j|j|jt|�|�|j|j|jd|�|j|j|jdt|��|j|j|jdt|��|j|j|jdd�|j|j|jdd�|j|j|jdd�|j	ii�idd6}i}|jtjj|j	||�|j
|�|j	||�d|d<|jtjj|j	||d�|j|j|j	d|�|j|j|j	g|�|j|j|j	dd�dS)Nrr}r5r�zThese are unequal)ZassertListEqualZassertTupleEqual�assertSequenceEqualr+r"r#r,�tuple�extend�assertDictEqual�update)rr}r~rcr�r
r
r�testEquality�sT





zTest_TestCase.testEqualityc.CsG|j|jd�ddd}ddd
}djtjtj|�j�tj|�j���}tj	j
t|�df}t|�d|_y|j||�Wn5|j
k
r�}z|jd	}WYdd}~XnX|jd
�|jt|�t|��|j||�t|�d|_y|j||�Wn5|j
k
r{}z|jd	}WYdd}~XnX|jd
�|jt|�t|��|j||�d|_y|j||�Wn5|j
k
r	}z|jd	}WYdd}~XnX|jd
�|jt|�t|��|j||�dS)N�P�r}r�r(r~�
r5rz!assertSequenceEqual did not fail.i�ii)r)�maxDiffr��difflibZndiff�pprintZpformat�
splitlinesr"�case�DIFF_OMITTED�lenr�r,�argsr3�
assertLessr��
assertGreaterr�)rZseq1Zseq2�diff�omitted�err
r
r�testAssertSequenceEqualMaxDiffs< 
 
	 
z,Test_TestCase.testAssertSequenceEqualMaxDiffcCs�d|_|jdd�}tjjtd�}|j|d|�d|_|jdd�}|j|d�d|_|jdd�}|j|d�dS)Nr5r
�barZfoobarr�)r��_truncateMessager"r�r�r�r))r�messager�r
r
r�testTruncateMessage.s			z!Test_TestCase.testTruncateMessagecCs�tjd�}dd�}||_y|jiidd6�Wn>|jk
r}z|jt|�d�WYdd}~XnX|jd�dS)Nr)cSsdS)Nr
r
)rr�r
r
r�truncate>sz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncaterr5r
zassertDictEqual did not fail)r"r#r�r�r,r)rnr3)rrr�r�r
r
r�testAssertDictEqualTruncates<s	)z*Test_TestCase.testAssertDictEqualTruncatescCs�tjd�}dd�}||_y|jdd�Wn>|jk
rx}z|jt|�d�WYdd}~XnX|jd�dS)Nr)cSsdS)Nr
r
)rr�r
r
rr�JszATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncater
r�z!assertMultiLineEqual did not fail)r"r#r��assertMultiLineEqualr,r)rnr3)rrr�r�r
r
r�!testAssertMultiLineEqualTruncatesHs	)z/Test_TestCase.testAssertMultiLineEqualTruncatescs��j�jd�d�_�j�d�_�j��fdd��d}�j�j��}�j|d|d	�WdQX�jd
t|j���j|d|d�dd}dd
�}�j	�|�_	�j��fdd��|d|d	}}�j�j��}�j||�WdQX�j
d
t|j���jt|j�d||f��j|d|d�dS)Nr(�r�cst�d��S)N�_diffThreshold)�setattrr
)�
old_thresholdrr
r�<lambda>]sz=Test_TestCase.testAssertEqual_diffThreshold.<locals>.<lambda>r�r�r}r~�^rPcSstd��dS)Nzthis should not be raised)�SystemError)r�r�r
r
r�explodingTruncationkszHTest_TestCase.testAssertEqual_diffThreshold.<locals>.explodingTruncationcst�d��S)Nr�)r�r
)�old_truncaterr
rr�osz%r != %ri� r�Zxxxxxxxxxxxxxxxx�@)r)r�r��
addCleanupr+r,r�rn�	exceptionr�r�)r�s�cmr�r�r�r
)r�r�rr�testAssertEqual_diffThresholdTs*			
		#z+Test_TestCase.testAssertEqual_diffThresholdcs��j�d�_�j��fdd��dd}|d|d}}�j�j��}�j||�WdQXddd	}�jt|j�d
||f��j|d|d�dd}|d||d|}}�j�j��}�j||�WdQXd
}�jt|j�d||||f�dd}|d||d|}}�j�j��}�j||�WdQXd}ddd}�jt|j�d||||f�dS)Nrcst�d��S)Nr�)r�r
)r�rr
rr�|sz7Test_TestCase.testAssertEqual_shorten.<locals>.<lambda>r��dr}r~zxxxx[35 chars]�=z'%sa' != '%sb'�y�2zxxxx[85 chars]xxxxxxxxxxxz'%sa%s' != '%sb%s'zxxxx[91 chars]xxxxx�(z[56 chars]yyyy)r�r�r+r,r)rnr�)rr�r�r�r�rc�pr�r
)r�rr�testAssertEqual_shortenxs.		
#
)
z%Test_TestCase.testAssertEqual_shortencCsyt�}|jdddgdddg�|jdddgdddg�|j||dddg|dd|df�|jddddgddd	dg�|j|j|jddgdgd
dgd
ddg�|j|j|jddddgddd	dg�|j|j|jdgddg�|j|j|jddgdg�|j|j|jdddgddg�|jddgdd
gdgddd
gddgg�|jtddgdd
g�tddgdd
g��|j|j|jgtddddt�g�|jidd6idd6gidd6idd6g�|jddtggtgddg�|j|j|jgtgddddt�g�|j|j|jdggdgg�|j|j|jdddgddg�|j|j|jdddddgddd	dg�|j|j|jdidd6dd	gidd6d	dg�dd
hddhg}|ddd�}|j||�ttj	j
dd��}ddddh}|j||�tj	j
ggg�}|j|ddgfg�ttj	jdd��}dddd h}|j||�dS)!Nr5r(r'r
r�Zbaz�2r}Tr�r0�r�rFr�y@y@r~ZaaabccdZabbbccer�r����)r'r5r})r5r'r~)r5rr�)rr5r�)r'r5r})r5r'r~)r5rr�)rr5r�)
r�ZassertCountEqualr+r,�iter�divmodr�r�r"�utilZ_count_diff_all_purposer)Z_count_diff_hashable)rr}r~Zdiffsr@r
r
r�testAssertCountEqual�sV	"".(,":8("%-z"Test_TestCase.testAssertCountEqualcCs*t�}t�}|j||�|j|j|jd|�|j|j|jg|�|j|j|j|d�|j|j|j|g�tdg�}t�}|j|j|j||�tdg�}tdg�}|j||�tdg�}tddg�}|j|j|j||�tdg�}tddg�}|j|j|j||�tddg�}tddg�}|j||�t�}d}|j|j|j||�|j|j|j||�td
dg�}tdg�}|j|j|j||�dS)
Nr}r~r
rr5r(r'r�r�)rr5)r(r')r�r�)r�ZassertSetEqualr+r,r�)rZset1Zset2r
r
r�testAssertSetEqual�s:				z Test_TestCase.testAssertSetEqualcCs$|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�|j|j|jdd�dS)	Nr(r5g�������?g�?ZbugZantsbugsant)r�ZassertGreaterEqualr�ZassertLessEqualr+r,)rr
r
r�testInequality�sbzTest_TestCase.testInequalitycCs�d}d}d}d|_y|j||�WnW|jk
r�}z4t|�jdd�d}|j||k�WYdd}~XnXdS)Nzxhttp://www.python.org/doc/2.3/lib/module-unittest.html
test case
    A test case is the smallest unit of testing. [...]
z�http://www.python.org/doc/2.4.1/lib/module-unittest.html
test case
    A test case is the smallest unit of testing. [...] You may provide your
    own implementation that does not subclass from TestCase, of course.
a�- http://www.python.org/doc/2.3/lib/module-unittest.html
?                             ^
+ http://www.python.org/doc/2.4.1/lib/module-unittest.html
?                             ^^^
  test case
-     A test case is the smallest unit of testing. [...]
+     A test case is the smallest unit of testing. [...] You may provide your
?                                                       +++++++++++++++++++++
+     own implementation that does not subclass from TestCase, of course.
r�r5)r�r�r,rn�split�
assertTrue)r�sample_text�revised_sample_text�sample_text_errorr��errorr
r
r�testAssertMultiLineEqual5s	z&Test_TestCase.testAssertMultiLineEqualcCs�d}d}d}y|j||�WnW|jk
r}z4t|�jdd�d}|j||k�WYdd}~XnXdS)Nzladen swallows fly slowlyzunladen swallows fly quicklyzr- laden swallows fly slowly
?                    ^^^^
+ unladen swallows fly quickly
? ++                   ^^^^^
r�r5)r)r,rnr�r�)rr�r�r�r�r�r
r
r�testAsertEqualSingleLineWsz&Test_TestCase.testAsertEqualSingleLinecCsP|jd�|j|j|jd�|jd�|j|j|jd�dS)NFzDjZoPloGears on Rails)rwr+r,ZassertIsNotNone)rr
r
r�testAssertIsNonefs

zTest_TestCase.testAssertIsNonecCs0|jdd�|j|j|jdd�dS)NZ
asdfabasdfzab+ZsaaasZaaaa)ZassertRegexr+r,)rr
r
r�testAssertRegexlszTest_TestCase.testAssertRegexcs�Gdd�dt���fdd�}|j�|�|jt�f|�|jttddd�|j|j��|j�dd	��WdQX|j���|jt|�WdQXdS)
Nc@seZdZdS)z=Test_TestCase.testAssertRaisesCallable.<locals>.ExceptionMockN)rrrr
r
r
r�
ExceptionMockrsr�cs�d��dS)Nz	We expectr
r
)r�r
r�Stubtsz4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19�baser�cSsdS)Nrr
r
r
r
rr�}sz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr+r2�intr,)rr�r
)r�r�testAssertRaisesCallableqsz&Test_TestCase.testAssertRaisesCallablec(sGdd�dt���fdd�}|j���|�WdQX|jt�f��}|�WdQX|j|j��|j|jjdd�|jt��tddd	�WdQX|j|j��|j���WdQXWdQX|j���|jt|�WdQXdS)
Nc@seZdZdS)z<Test_TestCase.testAssertRaisesContext.<locals>.ExceptionMockN)rrrr
r
r
rr��sr�cs�d��dS)Nz	We expectr
r
)r�r
rr��sz3Test_TestCase.testAssertRaisesContext.<locals>.Stubrz	We expectr�r�r�)	r�r+r2rmr�r)r�r�r,)rr�r�r
)r�r�testAssertRaisesContext�s

z%Test_TestCase.testAssertRaisesContextcs[Gdd�dt���fdd�}|j�tjd�|�|j�d|�dS)Nc@seZdZdS)z:Test_TestCase.testAssertRaisesRegex.<locals>.ExceptionMockN)rrrr
r
r
rr��sr�cs�d��dS)Nz	We expectr
r
)r�r
rr��sz1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)r��assertRaisesRegex�re�compile)rr�r
)r�r�testAssertRaisesRegex�sz#Test_TestCase.testAssertRaisesRegexcCs]|j|jd|jttjd�dd��|j|jd|jtddd��dS)Nz"^Exception not raised by <lambda>$r�cSsdS)Nr
r
r
r
rr��sz8Test_TestCase.testAssertNotRaisesRegex.<locals>.<lambda>cSsdS)Nr
r
r
r
rr��s)r�r,r�r�r�)rr
r
r�testAssertNotRaisesRegex�s	
	z&Test_TestCase.testAssertNotRaisesRegexcCs9Gdd�dt�}|jt|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcN)rrrr
r
r
r�MyExc�sr�cSsdS)NTr
r
r
r
rr��szATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)r�r+�	TypeErrorr�)rr�r
r
r�!testAssertRaisesRegexInvalidRegex�sz/Test_TestCase.testAssertRaisesRegexInvalidRegexcCs9Gdd�dt�}|jt|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnN)rrrr
r
r
r�MyWarn�srcSsdS)NTr
r
r
r
rr��sz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr+r��assertWarnsRegex)rrr
r
r� testAssertWarnsRegexInvalidRegex�sz.Test_TestCase.testAssertWarnsRegexInvalidRegexcCs]dd�}|j|jd|jtd|�|j|jd|jttjd�|�dS)NcSstd��dS)NZ
Unexpected)r�r
r
r
rr��sz9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)r�r,r�r�r�)rr�r
r
r�testAssertRaisesRegexMismatch�s	z+Test_TestCase.testAssertRaisesRegexMismatchc	s�Gdd�dt���fdd�}d}|j��}|�||�WdQX|j}|j|��|j|jd|�dS)Nc@seZdZdS)z=Test_TestCase.testAssertRaisesExcValue.<locals>.ExceptionMockN)rrrr
r
r
rr��sr�cs�|��dS)Nr
)r
)r�r
rr��sz4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)r�r+r�rmr)r�)rr��vZctxr�r
)r�r�testAssertRaisesExcValue�s	z&Test_TestCase.testAssertRaisesExcValuec#Cs&dd�}|jt|�|jt|�|jttf|�|jttjddt�|j|j��|jtdd��WdQXtj��>tjdt�|j|j��|jt|�WdQXWdQXtj��;tjdt�|jt��|jt|�WdQXWdQXdS)	NcSstjdt�dS)Nr
)r��warn�RuntimeWarningr
r
r
r�
_runtime_warn�sz<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr
�categorycSsdS)Nrr
r
r
r
rr��sz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultr�)	�assertWarnsrr�r�rr+r,r�r�)rr	r
r
r�testAssertWarnsCallable�s 	

z%Test_TestCase.testAssertWarnsCallablecLCs�dd�}tj|�d}|jt��}|�WdQX|jttf��}|�WdQX|j|jt�|j|jjdd�|j	d|j
�|j|j|d�|jt��|�|�WdQX|jt��tj
ddt�WdQX|j|j��|jt��WdQXWdQXtj��Ktjdt�|j|j��"|jt��|�WdQXWdQXWdQXtj��Htjd	t�|jt��"|jt��|�WdQXWdQXWdQXdS)
NcSstjdt�dS)Nr
)r�rrr
r
r
rr	�sz;Test_TestCase.testAssertWarnsContext.<locals>._runtime_warnr5rr
ztest_case.pyr
rr�)�inspect�getsourcelinesrrr�rm�warningr)r�r��filename�linenor�rr+r,r�r�)rr	�_runtime_warn_linenor�r
r
r�testAssertWarnsContext�s8




z$Test_TestCase.testAssertWarnsContextc+Cs1dd�}|jtd|d�|j|j��|jtddd��WdQXtj��Dtjdt�|j|j��|jtd|d�WdQXWdQX|j|j��|jtd|d�WdQXtj��Jtjd	t�|jt|jf��|jtd|d�WdQXWdQXdS)
NcSstj|t�dS)N)r�rr)rr
r
rr	szATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warnzo+�fooxcSsdS)Nrr
r
r
r
rr�"sz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>r�barzr�)rrr+r,r�r�r�r�)rr	r
r
r�testAssertWarnsRegexCallables&


z*Test_TestCase.testAssertWarnsRegexCallablecGCs�dd�}tj|�d}|jtd��}|d�WdQX|j|jt�|j|jjdd�|jd|j	�|j|j
|d�|j|j��|jtd��WdQXWdQXt
j��Qt
jdt�|j|j��(|jtd��|d�WdQXWdQXWdQX|j|j��(|jtd��|d	�WdQXWdQXt
j��Wt
jd
t�|jt|jf��(|jtd��|d	�WdQXWdQXWdQXdS)NcSstj|t�dS)N)r�rr)rr
r
rr	:sz@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnr5zo+rrztest_case.pyrrr�)rrrrrmrr)r�r�rrr+r,r�r�r�r�)rr	rr�r
r
r�testAssertWarnsRegexContext8s0

z)Test_TestCase.testAssertWarnsRegexContextc	cs1t��}dVWdQX|j|j�d�dS)Nr�)r	r)�getvalue)rZbufr
r
r�assertNoStderr\szTest_TestCase.assertNoStderrcCs�|jt|�t|��xft||�D]U\}}|j|tj�x3|j�D]%\}}|jt||�|�qXWq,WdS)N)r)r��ziprm�loggingZ	LogRecord�items�getattr)r�recordsZmatchesZrec�match�krr
r
r�assertLogRecordsbs
zTest_TestCase.assertLogRecordscCsy|j��g|j��!}tjd�tjd�WdQX|j|jdg�|j|j	idd6g�WdQXdS)N�1r�z
INFO:foo:1r
�name)
r�
assertLogs�log_foo�info�
log_foobar�debugr)�outputr"r)rr�r
r
r�testAssertLogsDefaultsis

z$Test_TestCase.testAssertLogsDefaultscCs�|j���|j��.}tjd�tjd�tjd�WdQX|j|j	ddg�|j
|jidd6idd6g�WdQXdS)	Nr#r��3z
INFO:foo:1zWARNING:quux:3r
r$r)rr%r&r'r(r)�log_quuxrr)r*r"r)rr�r
r
r�!testAssertLogsTwoMatchingMessagesrs


z/Test_TestCase.testAssertLogsTwoMatchingMessagescCs�|j���|jd|��.}tjd�tjd�tjd�WdQX|j|j	ddg�|j
|jidd6id	d6g�WdQXdS)
N�levelr#r�r,zERROR:foo.bar:2zCRITICAL:quux:3zfoo.barr$r)rr%r&rr(r�r-Zcriticalr)r*r"r)rr/r�r
r
r�checkAssertLogsPerLevel}s


z%Test_TestCase.checkAssertLogsPerLevelcCs!|jtj�|jd�dS)N�ERROR)r0rr1)rr
r
r�testAssertLogsPerLevel�sz$Test_TestCase.testAssertLogsPerLevelcCs�|j���|jdd���}|j|dd��.}tjd�tjd�tjd�WdQX|j|j	ddg�|j
|jidd	6id
d	6g�WdQX|j|j	dg�WdQXdS)Nr/�DEBUGr#r�r,z
INFO:foo:1zDEBUG:foo.bar:2r
r$zfoo.barzWARNING:quux:3)rr%r&r'r(r)r-rr)r*r"r)rZloggerZouter_cmr�r
r
r�checkAssertLogsPerLogger�s


!z&Test_TestCase.checkAssertLogsPerLoggercCs'|jtjd��|jd�dS)Nr
)r4r�	getLogger)rr
r
r�testAssertLogsPerLogger�sz%Test_TestCase.testAssertLogsPerLoggercCsC|j��1|j|j��|j��WdQXWdQXWdQXdS)N)rr+r,r%)rr
r
r�testAssertLogsFailureNoLogs�s

z)Test_TestCase.testAssertLogsFailureNoLogscCsV|j��D|j|j��+|jdd��tjd�WdQXWdQXWdQXdS)Nr/ZWARNINGr#)rr+r,r%r&r')rr
r
r�!testAssertLogsFailureLevelTooHigh�s
z/Test_TestCase.testAssertLogsFailureLevelTooHighcCs\|jddd��A|j|j��(|jd��tjd�WdQXWdQXWdQXdS)Nrr/r1r
r#)r%r+r,r-r�)rr
r
r�&testAssertLogsFailureMismatchingLogger�sz4Test_TestCase.testAssertLogsFailureMismatchingLoggercCs:|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|j	df|j
tdd�ff|jdf|j
td
ddd
�td
ddd
dd�ff|jtddd�ff|jdff}x4|D],\}}|jt��||�WdQXqWdS)zY
        Test that the deprecated methods raise a DeprecationWarning. See #9424.
        r'r��@�@�@TcSsddS)Ng��Q�	@Zspamr
)�_r
r
rr��sz9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>Fr}r5r~r(rcr
cSsidS)Nr
r
r
r
r
rr��sr�N)r'r�)r'r�)r'r')r'r')r:r:)r:r:)r;r<)r;r<)T)T)F)�barr>)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesr��failIfr�r�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrr�)r�old�methr�r
r
r�testDeprecatedMethodNames�s$6z'Test_TestCase.testDeprecatedMethodNamescCsstjdd�dkrdSdddddd	d
dg}x1|D])}|jt��t||�WdQXqBWdS)
z9Test that the deprecated fail* methods get removed in 3.xNr(r'r?r@rArBrCrDrEr�)r'r')�sys�version_infor+r-r)rZdeprecated_namesZdeprecated_namer
r
r�_testDeprecatedFailMethods�s		
z(Test_TestCase._testDeprecatedFailMethodscCs3Gdd�dtj�}|d�}t|�dS)Nc@seZdZdd�ZdS)z0Test_TestCase.testDeepcopy.<locals>.TestableTestcSsdS)Nr
)rr
r
r�testNothing�sz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrrMr
r
r
r�TestableTest�srNrM)r"r#r)rrNrr
r
r�testDeepcopy�szTest_TestCase.testDeepcopycCs{tjd�}xettjd�D]P}tj|d|�}tj|�}|j||�|jt�t��q#WdS)Nr.r5�protocol)	r"r#r��pickleZHIGHEST_PROTOCOL�dumps�loadsr)r�)rrrPZpickled_testZunpickled_testr
r
r�
testPickle�szTest_TestCase.testPicklec
s�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}x@||||fD],}|jt��|d
�j�WdQXq�WdS)NcSs
t�dS)N)�KeyboardInterrupt)rr
r
r�_raise�sz3Test_TestCase.testKeyboardInterrupt.<locals>._raisecSsdS)Nr
)rr
r
r�nothing�sz4Test_TestCase.testKeyboardInterrupt.<locals>.nothingcseZdZ�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test1N)rrr�test_somethingr
)rVr
r�Test1�srYcseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N)rrrrrXr
)rVrWr
r�Test2srZcseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N)rrrrXr r
)rVrWr
r�Test3sr[cs"eZdZ�fdd�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4cs|j��dS)N)r�)r)rVr
rrX
szATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingN)rrrrXr
)rVr
r�Test4	sr\rX)r"r#r+rUr.)rrYrZr[r\�klassr
)rVrWr�testKeyboardInterrupt�s""z#Test_TestCase.testKeyboardInterruptcs	ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xe||||fD]Q}tj�}|d
�j|�|jt|j�d�|j|jd�q�WdS)NcSstjd��dS)Nzsome reason)r"ZSkipTest)rr
r
r�_skipsz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSsdS)Nr
)rr
r
rrWsz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcseZdZ�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1N)rrrrXr
)r_r
rrYsrYcseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2N)rrrrrXr
)r_rWr
rrZsrZcseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3N)rrrrXr r
)r_rWr
rr[sr[cs"eZdZ�fdd�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cs|j��dS)N)r�)r)r_r
rrX#szBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingN)rrrrXr
)r_r
rr\"sr\rXr5)r"r#r9r.r)r�Zskipped�testsRun)rrYrZr[r\r]r:r
)r_rWr�testSkippingEverywheres""z$Test_TestCase.testSkippingEverywherecs	ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xe||||fD]Q}tj�}|d
�j|�|jt|j�d�|j|jd�q�WdS)NcSs
t�dS)N)�
SystemExit)rr
r
rrV-sz,Test_TestCase.testSystemExit.<locals>._raisecSsdS)Nr
)rr
r
rrW/sz-Test_TestCase.testSystemExit.<locals>.nothingcseZdZ�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test1N)rrrrXr
)rVr
rrY2srYcseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test2N)rrrrrXr
)rVrWr
rrZ5srZcseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test3N)rrrrXr r
)rVrWr
rr[9sr[cs"eZdZ�fdd�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test4cs|j��dS)N)r�)r)rVr
rrX>sz:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingN)rrrrXr
)rVr
rr\=sr\rXr5)r"r#r9r.r)r��errorsr`)rrYrZr[r\r]r:r
)rVrWr�testSystemExit,s""zTest_TestCase.testSystemExitc	CsEtj�}tj|�}tj��~|j|��WdQXdS)N)r"r#�weakref�refrZ
disable_gcr�)rr��wrr
r
r�testNoCyclesGs

zTest_TestCase.testNoCyclescsyG�fdd�dt��G�fdd�dtj�}x7dD]/}||�}|j�|j�jd�qBWdS)	Ncs:eZdZdZ�fdd�Z�fdd�ZdS)z9Test_TestCase.test_no_exception_leak.<locals>.MyExceptionrcs �jd7_tj|�dS)Nr5)�	ninstancer�r)r)r%r
rrUszBTest_TestCase.test_no_exception_leak.<locals>.MyException.__init__cs�jd8_dS)Nr5)ri)r)r%r
r�__del__YszATest_TestCase.test_no_exception_leak.<locals>.MyException.__del__N)rrrrirrjr
)r%r
rr%Rsr%cs=eZdZ�fdd�Zej�fdd��ZdS)z6Test_TestCase.test_no_exception_leak.<locals>.TestCasecs
���dS)Nr
)r)r%r
rr]sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test1cs
���dS)Nr
)r)r%r
rr`sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test2N)rrrrr"ZexpectedFailurerr
)r%r
rr#\sr#rrr)ztest1ztest2)r�r"r#r.r)ri)rr#Zmethod_nameZtestcaser
)r%r�test_no_exception_leakOs


z$Test_TestCase.test_no_exception_leakN)irrrrrZeq_pairsrZne_pairsr/r1r4r6r;rArDrErFrHrIrJrKrLrSrVrWrXrZr[r]rerhrirjrkrlrorqrsrvryr"ZskipIfrJ�flags�optimizerzr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrr�
contextlib�contextmanagerrr"r+r.r0r2r4r6r7r8r9rIrLrOrTr^rardrZcpython_onlyrhrkr
r
r
rr$8s�!!

		

!
	

%4($>(:"

($	
r$�__main__)!rnr�r�rQr�rJrr�rer�copyrrrr"Zunittest.test.supportrrrrrZtest.supportr	r5r&r(r-r�rr#r$r�mainr
r
r
r�<module>s6(������8