HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/unittest/test/__pycache__/test_case.cpython-37.pyc
B

"��g} �@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlZddlmZmZmZmZmZddlmZe�d�Ze�d�Ze�d�ZGd	d
�d
e�ZGdd�dejee�Ze d
kr�e�!�dS)�N)�deepcopy)�support)�TestEquality�TestHashing�
LoggingResult�LegacyLoggingResult�#ResultWithNoStartTestRunStopTestRun)�captured_stderr�foozfoo.bar�quuxc@sDeZdZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)	�Testz5Keep these TestCase classes out of the main namespacec@seZdZdd�Zdd�ZdS)zTest.FoocCsdS)N�)�selfr
r
�3/usr/local/lib/python3.7/unittest/test/test_case.py�runTest"�zTest.Foo.runTestcCsdS)Nr
)rr
r
r�test1#rzTest.Foo.test1N)�__name__�
__module__�__qualname__rrr
r
r
r�Foo!src@seZdZdd�ZdS)zTest.BarcCsdS)Nr
)rr
r
r�test2&rzTest.Bar.test2N)rrrrr
r
r
r�Bar%srcs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
zTest.LoggingTestCasez!A test case which logs its calls.csttj|��d�||_dS)N�test)�superr�LoggingTestCase�__init__�events)rr)�	__class__r
rr+szTest.LoggingTestCase.__init__cCs|j�d�dS)N�setUp)r�append)rr
r
rr/szTest.LoggingTestCase.setUpcCs|j�d�dS)Nr)rr )rr
r
rr2szTest.LoggingTestCase.testcCs|j�d�dS)N�tearDown)rr )rr
r
rr!5szTest.LoggingTestCase.tearDown)	rrr�__doc__rrrr!�
__classcell__r
r
)rrr(s
rN)	rrrr"�unittest�TestCaserrrr
r
r
rrsrc@s�eZdZe�d�e�d�fgZe�d�e�d�fe�d�e�d�fe�d�e�d�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'dDdE�Z(e)�*e+j,j-dFkdG�dHdI��Z.e)�*e+j,j-dFkdG�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��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYeZj[d�d���Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d��Zld�dÄZmenjod�dń�Zpd�dDŽZqd�S)��
Test_TestCaserrrc	Cs�Gdd�dtj�}|�|���dd�d�t��}|�dd�|�|j��|�dd�WdQRX|�t��|��WdQRXdS)Nc@seZdZdd�Zdd�ZdS)z3Test_TestCase.test_init__no_test_name.<locals>.TestcSs
t��dS)N)�MyException)rr
r
rrUrz;Test_TestCase.test_init__no_test_name.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrVrz8Test_TestCase.test_init__no_test_name.<locals>.Test.testN)rrrrrr
r
r
rrTsri�z
.Test.runTest��)r$r%�assertEqual�id�assertRaises�failureException�AttributeError�run)rrrr
r
r�test_init__no_test_nameSsz%Test_TestCase.test_init__no_test_namecCs2Gdd�dtj�}|�|d���dd�d�dS)Nc@seZdZdd�Zdd�ZdS)z7Test_TestCase.test_init__test_name__valid.<locals>.TestcSs
t��dS)N)r')rr
r
rrjrz?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrkrz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testN)rrrrrr
r
r
rrisrri����z
.Test.test)r$r%r*r+)rrr
r
r�test_init__test_name__validhsz)Test_TestCase.test_init__test_name__validcCsBGdd�dtj�}y|d�Wntk
r2YnX|�d�dS)Nc@seZdZdd�Zdd�ZdS)z9Test_TestCase.test_init__test_name__invalid.<locals>.TestcSs
t��dS)N)r')rr
r
rrurzATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrvrz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testN)rrrrrr
r
r
rrtsrZtestfoozFailed to raise ValueError)r$r%�
ValueError�fail)rrr
r
r�test_init__test_name__invalidssz+Test_TestCase.test_init__test_name__invalidcCs*Gdd�dtj�}|�|d���d�dS)Nc@seZdZdd�ZdS)z.Test_TestCase.test_countTestCases.<locals>.FoocSsdS)Nr
)rr
r
rr�rz3Test_TestCase.test_countTestCases.<locals>.Foo.testN)rrrrr
r
r
rr�srr�)r$r%r*ZcountTestCases)rrr
r
r�test_countTestCases�sz!Test_TestCase.test_countTestCasescCs2Gdd�dtj�}|���}|�t|�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�sr)r$r%�defaultTestResultr*�type�
TestResult)rr�resultr
r
r�test_defaultTestResult�s
z$Test_TestCase.test_defaultTestResultcsLg}t|�}G�fdd�dtj���|��|�ddddg}|�||�dS)NcseZdZ��fdd�Z�ZS)z>Test_TestCase.test_run_call_order__error_in_setUp.<locals>.Foocst�|���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
)r)rrr�sr�	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_setUpcsFg}G�fdd�dtj���|���ddddddg}|�||�dS)	Ncs&eZdZdd�Z��fdd�Z�ZS)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.defaultTestResultcst�|���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
)r)rrr�sr�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}�|��|�|�||�dS)	NcseZdZ��fdd�Z�ZS)z=Test_TestCase.test_run_call_order__error_in_test.<locals>.Foocst�|���td��dS)Nzraised by Foo.test)rrr<)r)rrr
rr�szBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test)rrrrr#r
)r)rrr�srr=rrr!r>r?)rrrr/r*)rrr:r@r
)rr�"test_run_call_order__error_in_test�sz0Test_TestCase.test_run_call_order__error_in_testcsJg}G�fdd�dtj��ddddddd	d
g}�|���|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)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.defaultTestResultcst�|���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
)r)rrr�srrBr=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}�|��|�|�||�dS)	NcseZdZ��fdd�Z�ZS)z?Test_TestCase.test_run_call_order__failure_in_test.<locals>.Foocst�|���|�d�dS)Nzraised by Foo.test)rrr3)r)rrr
rr�szDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.test)rrrrr#r
)r)rrr�srr=rrr!�
addFailurer?)rrrr/r*)rrr:r@r
)rr�$test_run_call_order__failure_in_test�sz2Test_TestCase.test_run_call_order__failure_in_testcsJG�fdd�dtj��ddddddd	d
g}g}�|���|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)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.defaultTestResultcst�|���|�d�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
)r)rrr�srrBr=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���|��|�ddddddg}|�||�dS)	NcseZdZ��fdd�Z�ZS)zATest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foocst�|���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
)r)rrrsrr=rrr!r>r?)rrrr/r*)rrr:r@r
)rr�&test_run_call_order__error_in_tearDowns
z4Test_TestCase.test_run_call_order__error_in_tearDowncsJG�fdd�dtj��g}�|���ddddddd	d
g}|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)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.defaultTestResultcst�|���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
)r)rrrsrrBr=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���dS)Nc@seZdZdd�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
rr0szBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrr7rr
r
r
rr-srr)r$r%r/)rrr
r
r�"test_run_call_order_default_result+sz0Test_TestCase.test_run_call_order_default_resultcs4G�fdd�dtj���|��|�|�||�dS)NcseZdZ��fdd�Z�ZS)z6Test_TestCase._check_call_order__subtests.<locals>.Foocs�t�|���xpdD]h}|j|d��R|dkr8|�d�x8dD]0}|j|d��||dkrdtd��WdQRXq>WWdQRXqWdd	dS)
N)r5r)r()�ir5�failure)r)r()�j�zraised by Foo.testr)rr�subTestr3r<)rrMrO)rrr
rr7s


$z;Test_TestCase._check_call_order__subtests.<locals>.Foo.test)rrrrr#r
)r)rrr6sr)rrr/r*)rr:r�expected_eventsr
)rr�_check_call_order__subtests5sz)Test_TestCase._check_call_order__subtestscCs8g}t|�}dddddddddddg}|�|||�dS)	Nr=rrr!�addSubTestFailure�addSubTestSuccessr>r?)rrS)rrr:r@r
r
r�test_run_call_order__subtestsMs
z+Test_TestCase.test_run_call_order__subtestscCs.g}t|�}ddddddg}|�|||�dS)Nr=rrr!rGr?)rrS)rrr:r@r
r
r�$test_run_call_order__subtests_legacyVs
z2Test_TestCase.test_run_call_order__subtests_legacycs4G�fdd�dtj���|��|�|�||�dS)NcseZdZ��fdd�Z�ZS)z>Test_TestCase._check_call_order__subtests_success.<locals>.Foocs^t�|���xJdD]B}|j|d��,x$dD]}|j|d��WdQRXq,WWdQRXqWdS)N)r5r))rM)r)r()rO)rrrQ)rrMrO)rrr
rras

zCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.test)rrrrr#r
)r)rrr`sr)rrr/r*)rr:rrRr
)rr�#_check_call_order__subtests_success_s	z1Test_TestCase._check_call_order__subtests_successcCs<g}t|�}ddddgddgddg}|�|||�dS)	Nr=rrr!rPrU�
addSuccessr?)rrX)rrr:r@r
r
r�%test_run_call_order__subtests_successlsz3Test_TestCase.test_run_call_order__subtests_successcCs.g}t|�}ddddddg}|�|||�dS)Nr=rrr!rYr?)rrX)rrr:r@r
r
r�,test_run_call_order__subtests_success_legacyvs
z:Test_TestCase.test_run_call_order__subtests_success_legacycsVg}t|�}d|_G�fdd�dtj��dddddd	g}�|��|�|�||�dS)
NTcseZdZ��fdd�Z�ZS)zATest_TestCase.test_run_call_order__subtests_failfast.<locals>.Fooc	s`t�|���|jdd��|�d�WdQRX|jdd��|�d�WdQRX|�d�dS)Nr5)rMrNr))rrrQr3)r)rrr
rr�szFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.test)rrrrr#r
)r)rrr�srr=rrr!rTr?)r�failfastrrr/r*)rrr:r@r
)rr�&test_run_call_order__subtests_failfast~s	z4Test_TestCase.test_run_call_order__subtests_failfastcsVg�G�fdd�dtj�}t��}d|_t�|�}|�|�dddg}|��|�dS)Ncs0eZdZ�fdd�Z�fdd�Z�fdd�ZdS)z1Test_TestCase.test_subtests_failfast.<locals>.Fooc	s,|�����d�WdQRX��d�dS)N�a1�a2)rQr )r)rr
r�test_a�s
z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_ac	sJ|�����d�WdQRX|���|�d�WdQRX��d�dS)N�b1rNZb2)rQr r3)r)rr
r�test_b�s


z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_bcs��d�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_failfastcs:g�G�fdd�dtj�}|d���|��ddg�dS)NcseZdZ�fdd�ZdS)z.Test_TestCase.test_subtests_debug.<locals>.Fooc	s,��d�|�����d�WdQRXdS)Nz	test casez	subtest 1)r rQ)r)rr
rr`�s

z5Test_TestCase.test_subtests_debug.<locals>.Foo.test_aN)rrrr`r
)rr
rr�srr`z	test casez	subtest 1)r$r%�debugr*)rrr
)rr�test_subtests_debug�sz!Test_TestCase.test_subtests_debugcCs(Gdd�dtj�}|�|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�srr)r$r%�assertIsr-�AssertionError)rrr
r
r�test_failureException__default�sz,Test_TestCase.test_failureException__defaultcCsXg}t|�}Gdd�dtj�}|�|d�jt�|d��|�dddg}|�||�dS)Nc@seZdZdd�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�srrr=rGr?)rr$r%rhr-r<r/r*)rrr:rr@r
r
r�2test_failureException__subclassing__explicit_raise�s
z@Test_TestCase.test_failureException__subclassing__explicit_raisecCsXg}t|�}Gdd�dtj�}|�|d�jt�|d��|�dddg}|�||�dS)Nc@seZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.FoocSs|�d�dS)Nr
)r3)rr
r
rr�szRTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.Foo.testN)rrrrr<r-r
r
r
rr�srrr=rGr?)rr$r%rhr-r<r/r*)rrr:rr@r
r
r�2test_failureException__subclassing__implicit_raise�s
z@Test_TestCase.test_failureException__subclassing__implicit_raisecCs Gdd�dtj�}|���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�sr)r$r%r)rrr
r
r�
test_setUp�szTest_TestCase.test_setUpcCs Gdd�dtj�}|���dS)Nc@seZdZdd�ZdS)z(Test_TestCase.test_tearDown.<locals>.FoocSsdS)Nr
)rr
r
rrsz0Test_TestCase.test_tearDown.<locals>.Foo.runTestN)rrrrr
r
r
rrsr)r$r%r!)rrr
r
r�
test_tearDown�szTest_TestCase.test_tearDowncCs(Gdd�dtj�}|�|���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
rrsr)r$r%�assertIsInstancer+�str)rrr
r
r�test_id
szTest_TestCase.test_idcs\g�t���G��fdd�dtj�}|d���}|�|��ddddddg}|��|�dS)	Ncs$eZdZ�fdd�Z�fdd�ZdS)z;Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foocs��d�dS)Nr)r )r)rr
rrsz@Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.testcs�S)Nr
)r)�
defaultResultr
rr7!szMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrrr7r
)rrrr
rrsrrrBr=rYr?rC)rr$r%r/rhr*)rrr:r@r
)rrrr� test_run__uses_defaultTestResultsz.Test_TestCase.test_run__uses_defaultTestResultcCs8Gdd�dtj�}t��}|d��|�}|�||�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_run__returns_given_result.<locals>.FoocSsdS)Nr
)rr
r
rr1sz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testN)rrrrr
r
r
rr0srr)r$r%r9r/rh)rrr:�retvalr
r
r�test_run__returns_given_result.sz,Test_TestCase.test_run__returns_given_resultcsDt���t���G��fdd�dtj�}|d���}|�|��dS)Ncs"eZdZdd�Z��fdd�ZdS)zKTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.FoocSsdS)Nr
)rr
r
rrAszPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|�|���S)N)rh)rr:)�resultIn�	resultOutr
rr/DszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrrr/r
)rvrwr
rr@srr)r$r9r%rh)rrrtr
)rvrwr�0test_call__invoking_an_instance_delegates_to_run<s
z>Test_TestCase.test_call__invoking_an_instance_delegates_to_runcCs|�|���dS)N)�assertIsNone�shortDescription)rr
r
r�$testShortDescriptionWithoutDocstringMsz2Test_TestCase.testShortDescriptionWithoutDocstringr)z)Docstrings are omitted with -O2 and abovecCs|�|��d�dS)z7Tests shortDescription() for a method with a docstring.N)r*rz)rr
r
r�(testShortDescriptionWithOneLineDocstringPsz6Test_TestCase.testShortDescriptionWithOneLineDocstringcCs|�|��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*rz)rr
r
r�*testShortDescriptionWithMultiLineDocstringXs	z8Test_TestCase.testShortDescriptionWithMultiLineDocstringcCs|�|��d�dS)z�
            Tests shortDescription() whitespace is trimmed, so that the first
            line of nonwhite-space text becomes the docstring.
        zATests shortDescription() whitespace is trimmed, so that the firstN)r*rz)rr
r
r�&testShortDescriptionWhitespaceTrimmingfsz4Test_TestCase.testShortDescriptionWhitespaceTrimmingcsVGdd�dt������}}|�||k�d�fdd�	}|��|�|�||�dS)Nc@seZdZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakez)Dummy class for test_addTypeEqualityFunc.N)rrrr"r
r
r
r�SadSnakepsrcs t|�t|�ko�kSS)N)r8)�a�b�msg)rr
r�AllSnakesCreatedEqualtszDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqual)N)�object�assertFalseZaddTypeEqualityFuncr*)r�s1�s2r�r
)rr�testAddTypeEqualityFuncosz%Test_TestCase.testAddTypeEqualityFunccCs,t�}|�||�|�|j|j|t��dS)N)r�rhr,r-)r�thingr
r
r�testAssertIs|szTest_TestCase.testAssertIscCs,t�}|�|t��|�|j|j||�dS)N)r�ZassertIsNotr,r-)rr�r
r
r�testAssertIsNot�szTest_TestCase.testAssertIsNotcCs(g}|�|t�|�|j|j|t�dS)N)ro�listr,r-�dict)rr�r
r
r�testAssertIsInstance�sz"Test_TestCase.testAssertIsInstancecCs(g}|�|t�|�|j|j|t�dS)N)ZassertNotIsInstancer�r,r-r�)rr�r
r
r�testAssertNotIsInstance�sz%Test_TestCase.testAssertNotIsInstancecCs�dddd�}|�dd�|�dddd	g�|�d
|�|�dd�|�dddd	g�|�d
|�|�|j|jdd�|�|j|jdddd	g�|�|j|jd|�|�|j|jdd�|�|j|jdddd	g�|�|j|jd|�dS)NZbananaZgrassZfish)�monkey�cowZsealr��abcr)r5r(r��drZotter�x�Zelephantrcr�)�assertIn�assertNotInr,r-)rZanimalsr
r
r�testAssertIn�szTest_TestCase.testAssertInc
Cs�t�����t�dt�|�ii�|�iddi�|�ddiddi�|�ddiddd��|�ddd�ddd��|�|j��|�ddii�WdQRX|�|j��|�ddiddi�WdQRX|�|j��|�ddiddi�WdQRX|�|j��|�ddd�ddi�WdQRX|�|j��|�ddd�ddi�WdQRXd	�d
d�td�D��}|�|j��|�d
|id
di�WdQRXWdQRXdS)N�ignorer�r5r))r�r��onerc)r�rc�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.testAssertDictContainsSubsetc	Cs�diifggft�t�ft�t�fg}x�|D]�\}}y|�||�Wn(|jk
rl|�d||f�YnXy|j||dd�Wn(|jk
r�|�d||f�YnXy|�||d�Wq,|jk
r�|�d||f�Yq,Xq,Wdgfit�ftdd	g�tdd
g�ftddg�td
dg�ftddg�tddg�fg}xT|D]L\}}|�|j|j||�|�|j|j||d�|j|j|j||dd��qFWdS)
N)r
r
zassertEqual(%r, %r) failedr
)r�z$assertEqual(%r, %r) with msg= failedz/assertEqual(%r, %r) with third parameter failedr
r�r5r)�r()�set�	frozensetr*r-r3r,)rZequal_pairsr�r�Z
unequal_pairsr
r
r�testAssertEqual�s<
zTest_TestCase.testAssertEqualcCs|�gg�|�dd�|�gd�ddgg}g}|�tjj|j||�|�tjj|jt|�t|��|�tjj|j|t|��|�|�|�||�|�t|�t|��|�|t|��|�t|�|�|�|j|j|t|��|�|j|jt|�|�|�|j|jd|�|�|j|jdt|��|�|j|jdt|��|�|j|jdd�|�|j|jdd�|�|j|jdd�|�	ii�ddi}i}|�tjj|j	||�|�
|�|�	||�d|d<|�tjj|j	||d�|�|j|j	d|�|�|j|j	g|�|�|j|j	dd�dS)Nr
rr�r5r�zThese are unequal)�assertListEqual�assertTupleEqual�assertSequenceEqualr,r$r%r-�tuple�extend�assertDictEqual�update)rr�r�rcr�r
r
r�testEquality�sT








zTest_TestCase.testEqualityc
Cs�|�|jd�ddd}ddd}d�t�t�|���t�|�����}tj	j
t|�df}t|�d|_y|�||�Wn.|j
k
r�}z|jd	}Wdd}~XYnX|�d
�|�t|�t|��|�||�t|�d|_y|�||�Wn0|j
k
�r(}z|jd	}Wdd}~XYnX|�d
�|�t|�t|��|�||�d|_y|�||�Wn0|j
k
�r�}z|jd	}Wdd}~XYnX|�d
�|�t|�t|��|�||�dS)Ni�r�r�ir��
r5r)rz!assertSequenceEqual did not fail.)r*�maxDiffr��difflibZndiff�pprintZpformat�
splitlinesr$�case�DIFF_OMITTED�lenr�r-�argsr3�
assertLessr��
assertGreaterr�)rZseq1Zseq2�diff�omitted�er�r
r
r�testAssertSequenceEqualMaxDiffs<


z,Test_TestCase.testAssertSequenceEqualMaxDiffcCsrd|_|�dd�}tjjtd�}|�|d|�d|_|�dd�}|�|d�d|_|�dd�}|�|d�dS)Nr5r
�bar�foobarr�)r��_truncateMessager$r�r�r�r*)r�messager�r
r
r�testTruncateMessageFsz!Test_TestCase.testTruncateMessagec
Cspt�d�}dd�}||_y|�iddi�Wn4|jk
r`}z|�t|�d�Wdd}~XYnX|�d�dS)Nr*cSsdS)Nr
r
)r�r�r
r
r�truncateVsz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncater5rr
zassertDictEqual did not fail)r$r%r�r�r-r*rpr3)rrr�r�r
r
r�testAssertDictEqualTruncatesTs
"z*Test_TestCase.testAssertDictEqualTruncatesc
Cslt�d�}dd�}||_y|�dd�Wn4|jk
r\}z|�t|�d�Wdd}~XYnX|�d�dS)Nr*cSsdS)Nr
r
)r�r�r
r
rr�bszATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncater
r�z!assertMultiLineEqual did not fail)r$r%r��assertMultiLineEqualr-r*rpr3)rrr�r�r
r
r�!testAssertMultiLineEqualTruncates`s
"z/Test_TestCase.testAssertMultiLineEqualTruncatesc	s0���jd�d�_�j�d�_����fdd��d}���j��}��|d|d�WdQRX��dt|j����|d|d�d	}d
d�}�j	�|�_	����fdd��|d|d}}���j��}��||�WdQRX��
dt|j����t|j�d
||f���|d|d�dS)Ni� cst�d��S)N�_diffThreshold)�setattrr
)�
old_thresholdrr
r�<lambda>urz=Test_TestCase.testAssertEqual_diffThreshold.<locals>.<lambda>Zxxxxxxxxxxxxxxxxr�r��^Z@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcSstd��dS)Nzthis should not be raised)�SystemError)r�r�r
r
r�explodingTruncation�szHTest_TestCase.testAssertEqual_diffThreshold.<locals>.explodingTruncationcst�d��S)Nr�)r�r
)�old_truncaterr
rr��rz%r != %r)r*r�r��
addCleanupr,r-r�rp�	exceptionr�r�)r�s�cmr�r�r�r
)r�r�rr�testAssertEqual_diffThresholdls*z+Test_TestCase.testAssertEqual_diffThresholdc	s\�j�d�_����fdd��d}|d|d}}���j��}��||�WdQRXd}��t|j�d||f���|d|d�d	}|d||d|}}���j��}��||�WdQRXd
}��t|j�d||||f�d}|d||d|}}���j��}��||�WdQRXd
}d}��t|j�d||||f�dS)Nrcst�d��S)Nr�)r�r
)r�rr
rr��rz7Test_TestCase.testAssertEqual_shorten.<locals>.<lambda>Zdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr�r�zKxxxx[35 chars]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz'%sa' != '%sb'Z2yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzxxxx[85 chars]xxxxxxxxxxxz'%sa%s' != '%sb%s'Zdyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzxxxx[91 chars]xxxxxz6yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy[56 chars]yyyy)r�r�r,r-r*rpr�)rr�r�r�r�rc�pr�r
)r�rr�testAssertEqual_shorten�s.z%Test_TestCase.testAssertEqual_shortencCst�}|�dddgdddg�|�dddgdddg�|�||dddg|dd|df�|�ddddgddd	dg�|�|j|jddgdgd
dgd
ddg�|�|j|jddddgddd	dg�|�|j|jdgddg�|�|j|jddgdg�|�|j|jdddgddg�|�ddgdd
gdgddd
gddgg�|�tddgdd
g�tddgdd
g��|�|j|jgtddddt�g�|�ddiddigddiddig�|�ddtggtgddg�|�|j|jgtgddddt�g�|�|j|jdggdgg�|�|j|jdddgddg�|�|j|jdddddgddd	dg�|�|j|jdddidd	gddid	dg�dd
hddhg}|ddd�}|�||�ttj	�
dd��}ddddh}|�||�tj	�
ggg�}|�|ddgfg�ttj	�dd��}ddddh}|�||�dS)Nr5r)r(r
r�Zbaz�2r�T�d�
�r�rFr�y@y@r����ZaaabccdZabbbcce)r(r5r�)r5r(r�)r5rr�)rr5r�)
r��assertCountEqualr,r-�iter�divmodr�r�r$�utilZ_count_diff_all_purposer*Z_count_diff_hashable)rr�r�Zdiffsr@r
r
r�testAssertCountEqual�sV $($z"Test_TestCase.testAssertCountEqualcCs�t�}t�}|�||�|�|j|jd|�|�|j|jg|�|�|j|j|d�|�|j|j|g�tdg�}t�}|�|j|j||�tdg�}tdg�}|�||�tdg�}tddg�}|�|j|j||�tdg�}tddg�}|�|j|j||�tddg�}tddg�}|�||�t�}d}|�|j|j||�|�|j|j||�tddg�}tdg�}|�|j|j||�dS)Nr�r�r
)rr5)r)r()r�r�)r��assertSetEqualr,r-r�)rZset1Zset2r
r
r�testAssertSetEqual�s:





z Test_TestCase.testAssertSetEqualcCs|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�dS)	Nr)r5g�������?g�?ZbugZantsbugsant)r�ZassertGreaterEqualr�ZassertLessEqualr,r-)rr
r
r�testInequalitysbzTest_TestCase.testInequalityc
Csld}d}d}d|_y|�||�WnD|jk
rf}z$t|��dd�d}|�||�Wdd}~XYnXdS)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-rp�splitr*)r�sample_text�revised_sample_text�sample_text_errorr��errorr
r
r�testAssertMultiLineEqualMsz&Test_TestCase.testAssertMultiLineEqualc
Csfd}d}d}y|�||�WnD|jk
r`}z$t|��dd�d}|�||�Wdd}~XYnXdS)Nzladen swallows fly slowlyzunladen swallows fly quicklyzr- laden swallows fly slowly
?                    ^^^^
+ unladen swallows fly quickly
? ++                   ^^^^^
r�r5)r*r-rpr�)rr�r�r�r�r�r
r
r�testAssertEqualSingleLinelsz'Test_TestCase.testAssertEqualSingleLinec
sHtjjr�fdd�}ndd�}|��*���j����dd�WdQRXWdQRX|����dd�WdQRXddg}ddg}|��*���j����||�WdQRXWdQRX|��2���j����t	|�t	|��WdQRXWdQRX|��.���j����
|t	|��WdQRXWdQRX|��.���j����
t	|�|�WdQRXWdQRX|��*���j����
dd�WdQRXWdQRX|��2���j����t|�t|��WdQRXWdQRX���j����|t	|��WdQRX���j����t	|�|�WdQRXddg}dg}���j����||�WdQRX���j����t	|�t	|��WdQRX���j����
|t	|��WdQRX���j����
t	|�|�WdQRX���j����t|�t|��WdQRXdg}ddg}���j����||�WdQRX���j����t	|�t	|��WdQRX���j����
|t	|��WdQRX���j����
t	|�|�WdQRX���j����t|�t|��WdQRX|��2���j����
ddiddi�WdQRXWdQRX���j����
iddi�WdQRX���j����
ddii�WdQRX���j����ddgdddg�WdQRX|����ddgddg�WdQRX|��2���j����ddgddg�WdQRXWdQRX|��6���j����ddggddgg�WdQRXWdQRXdS)Ncs��td�S)Nz#Comparison between bytes and string)�assertWarnsRegex�BytesWarningr
)rr
r�
bytes_warning~sz=Test_TestCase.testEqualityBytesWarning.<locals>.bytes_warningcSst��S)N)�
contextlib�	ExitStackr
r
r
rr��sr��ar)�sys�flagsr�r,r-r*ZassertNotEqualr�r�r�r�r�r�r�r�)rr�r�r�r
)rr�testEqualityBytesWarning|s~  ($$ (( (z&Test_TestCase.testEqualityBytesWarningcCs<|�d�|�|j|jd�|�d�|�|j|jd�dS)NFzDjZoPloGears on Rails)ryr,r-ZassertIsNotNone)rr
r
r�testAssertIsNone�s

zTest_TestCase.testAssertIsNonecCs$|�dd�|�|j|jdd�dS)NZ
asdfabasdfzab+ZsaaasZaaaa)ZassertRegexr,r-)rr
r
r�testAssertRegex�szTest_TestCase.testAssertRegexc	s�Gdd�dt���fdd�}|��|�|�t�f|�|jttddd�|�|j��|��dd	��WdQRX|�t��|��d�WdQRX|����|�t|�WdQRXdS)
Nc@seZdZdS)z=Test_TestCase.testAssertRaisesCallable.<locals>.ExceptionMockN)rrrr
r
r
r�
ExceptionMock�sr�cs�d��dS)Nz	We expectr
r
)r�r
r�Stub�sz4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19�)�basecSsdS)Nrr
r
r
r
rr��rz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr,r2�intr-�assertWarnsr�)rr�r
)r�r�testAssertRaisesCallable�sz&Test_TestCase.testAssertRaisesCallablecslGdd�dt���fdd�}|����|�WdQRX|�t�f��}|�WdQRX|�|j��|�|jjdd�|�t��tddd	�WdQRX|�|j��|����WdQRXWdQRX|�	|jd
�� |j�d
d��WdQRXWdQRX|�
td
��6|�t�� |j�dd
��WdQRXWdQRXWdQRX|����|�t|�WdQRXdS)Nc@seZdZdS)z<Test_TestCase.testAssertRaisesContext.<locals>.ExceptionMockN)rrrr
r
r
rr��sr�cs�d��dS)Nz	We expectr
r
)r�r
rr��sz3Test_TestCase.testAssertRaisesContext.<locals>.Stubrz	We expectr�r�)r�r�)r��*)r�)
rr,r2ror�r*r�rr-�assertRaisesRegexr�r�ri)rr�r�r
)r�r�testAssertRaisesContext�s,z%Test_TestCase.testAssertRaisesContextc	Cs�|�t��|��WdQRX|�t��|�d�WdQRX|�t��|�t�WdQRX|�t��|�tdf�WdQRX|�t��|�ttf�WdQRXdS)Nr5)r,�	TypeErrorr�r2)rr
r
r�testAssertRaisesNoExceptionTypesz-Test_TestCase.testAssertRaisesNoExceptionTypecCs4dd�}t�|�}|�t|�|�|t�|��dS)NcSs&yt�Wntk
r t�YnXdS)N)r2r
r
r
r�funcsz4Test_TestCase.testAssertRaisesRefcount.<locals>.func)r��getrefcountr,r2r*)rr	Zrefcountr
r
r�testAssertRaisesRefcounts
z&Test_TestCase.testAssertRaisesRefcountc	sfGdd�dt���fdd�}|��t�d�|�|��d|�|�t��|��dd�WdQRXdS)Nc@seZdZdS)z:Test_TestCase.testAssertRaisesRegex.<locals>.ExceptionMockN)rrrr
r
r
rr�"sr�cs�d��dS)Nz	We expectr
r
)r�r
rr�%sz1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)rr�re�compilerr�)rr�r
)r�r�testAssertRaisesRegex!sz#Test_TestCase.testAssertRaisesRegexcCs�|�|jd|jtt�d�dd��|�|jd|jtddd��|�|jd��"|jtddd��WdQRXWdQRX|�td��8|�t��"|jtdd	d
��WdQRXWdQRXWdQRXdS)Nz"^Exception not raised by <lambda>$r�cSsdS)Nr
r
r
r
rr�1rz8Test_TestCase.testAssertNotRaisesRegex.<locals>.<lambda>cSsdS)Nr
r
r
r
rr�5rr��expect)r�r)r�)	rr-rrr
r�r�r,ri)rr
r
r�testAssertNotRaisesRegex-s

z&Test_TestCase.testAssertNotRaisesRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcN)rrrr
r
r
r�MyExcBsrcSsdS)NTr
r
r
r
rr�DrzATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)rr,rr)rrr
r
r�!testAssertRaisesRegexInvalidRegex@sz/Test_TestCase.testAssertRaisesRegexInvalidRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnN)rrrr
r
r
r�MyWarnHsrcSsdS)NTr
r
r
r
rr�Jrz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr,rr�)rrr
r
r� testAssertWarnsRegexInvalidRegexFsz.Test_TestCase.testAssertWarnsRegexInvalidRegexcCsLGdd�dtj�}|d�tjd<z|�ttjd�Wdtjd=tjd=XdS)Nc@seZdZedd��ZdS)z:Test_TestCase.testAssertWarnsModifySysModules.<locals>.FoocSsdtjd<dS)Nr�z@bar@)r��modules)rr
r
r�__warningregistry__OszNTest_TestCase.testAssertWarnsModifySysModules.<locals>.Foo.__warningregistry__N)rrr�propertyrr
r
r
rrNsrr
z@foo@r@z@bar@)�types�
ModuleTyper�rr�UserWarningr��warn)rrr
r
r�testAssertWarnsModifySysModulesLsz-Test_TestCase.testAssertWarnsModifySysModulesc	CsBdd�}|�|jd|jtd|�|�|jd|jtt�d�|�dS)NcSstd��dS)NZ
Unexpected)rr
r
r
rr�[sz9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)rr-rrr
)rr�r
r
r�testAssertRaisesRegexMismatchZsz+Test_TestCase.testAssertRaisesRegexMismatchc	sjGdd�dt���fdd�}d}|���}|�||�WdQRX|j}|�|��|�|jd|�dS)Nc@seZdZdS)z=Test_TestCase.testAssertRaisesExcValue.<locals>.ExceptionMockN)rrrr
r
r
rr�jsr�cs�|��dS)Nr
)r
)r�r
rr�msz4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)rr,r�ror*r�)rr��vZctxr�r
)r�r�testAssertRaisesExcValueis
z&Test_TestCase.testAssertRaisesExcValuec	Cs�|�t��|��WdQRX|�t��|�t�WdQRX|�t��|�dd�WdQRX|�t��|�td�WdQRX|�t��|�tdfd�WdQRX|�t��|�ttfd�WdQRXdS)Nr5r)r,rrr2r�)rr
r
r�$testAssertRaisesRegexNoExceptionTypexsz2Test_TestCase.testAssertRaisesRegexNoExceptionTypec
Csdd�}|�t|�|�t|�|�ttf|�|jttjdtd�|�|j��|�tdd��WdQRX|�t��|�td�WdQRXt���6t�dt�|�|j��|�t|�WdQRXWdQRXt���4t�dt�|�t��|�t|�WdQRXWdQRXdS)	NcSst�dt�dS)Nr
)r�r�RuntimeWarningr
r
r
r�
_runtime_warn�sz<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr
)�categorycSsdS)Nrr
r
r
r
rr��rz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultr�)	rr"r�r�rr,r-r�r�)rr#r
r
r�testAssertWarnsCallable�s$
 
z%Test_TestCase.testAssertWarnsCallablecCs.dd�}t�|�d}|�t��}|�WdQRX|�ttf��}|�WdQRX|�|jt�|�|jjdd�|�	d|j
�|�|j|d�|�t��|�|�WdQRX|�t��tj
dtd�WdQRX|�|j��|�t��WdQRXWdQRX|�|jd�� |jtdd	��WdQRXWdQRX|�td��6|�t�� |jtd
d��WdQRXWdQRXWdQRXt���Ft�dt�|�|j��"|�t��|�WdQRXWdQRXWdQRXt���Dt�d
t�|�t��"|�t��|�WdQRXWdQRXWdQRXdS)NcSst�dt�dS)Nr
)r�rr"r
r
r
rr#�sz;Test_TestCase.testAssertWarnsContext.<locals>._runtime_warnr5rr
ztest_case.py)r$r�)r�r)r�r%r�)�inspect�getsourcelinesrr"r�ro�warningr*r�r��filename�linenor�rr,r-rr�rir�r�)rr#�_runtime_warn_linenor�r
r
r�testAssertWarnsContext�sF
$
z$Test_TestCase.testAssertWarnsContextc	Cs�|�t��|��WdQRX|�t��|�d�WdQRX|�t��|�t�WdQRX|�t��|�tdf�WdQRX|�t��|�ttf�WdQRX|�t��|�ttf�WdQRXdS)Nr5)r,rrr�rr)rr
r
r�testAssertWarnsNoExceptionType�sz,Test_TestCase.testAssertWarnsNoExceptionTypec
Cs&dd�}|�td|d�|�|j��|�tddd��WdQRX|�t��|�tdd�WdQRXt���:t�dt�|�|j��|�td|d�WdQRXWdQRX|�|j��|�td|d�WdQRXt���>t�d	t�|�t|jf��|�td|d�WdQRXWdQRXdS)
NcSst�|t�dS)N)r�rr")r�r
r
rr#�szATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warnzo+�fooxcSsdS)Nrr
r
r
r
rr��rz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>r%�barzr�)	r�r"r,r-rr�r�r�r�)rr#r
r
r�testAssertWarnsRegexCallable�s*

z*Test_TestCase.testAssertWarnsRegexCallablecCsdd�}t�|�d}|�td��}|d�WdQRX|�|jt�|�|jjdd�|�d|j	�|�|j
|d�|�|j��|�td��WdQRXWdQRX|�
|jd��"|jtddd	��WdQRXWdQRX|�td��8|�t��"|jtdd
d��WdQRXWdQRXWdQRXt���Jt�dt�|�|j��&|�td��|d�WdQRXWdQRXWdQRX|�|j��&|�td��|d
�WdQRXWdQRXt���Nt�dt�|�t|jf��&|�td��|d
�WdQRXWdQRXWdQRXdS)NcSst�|t�dS)N)r�rr")r�r
r
rr#sz@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnr5zo+r/rztest_case.pyr�)r�r)r�r%r0r�)r'r(r�r"ror)r*r�r�r*r+r,r-rr�rir�r�r�)rr#r,r�r
r
r�testAssertWarnsRegexContexts>
&
z)Test_TestCase.testAssertWarnsRegexContextc	Cs�|�t��|��WdQRX|�t��|�t�WdQRX|�t��|�dd�WdQRX|�t��|�td�WdQRX|�t��|�tdfd�WdQRX|�t��|�ttfd�WdQRX|�t��|�ttfd�WdQRXdS)Nr5r)r,rr�rr�r)rr
r
r�#testAssertWarnsRegexNoExceptionType0sz1Test_TestCase.testAssertWarnsRegexNoExceptionTypec	cs,t��}dVWdQRX|�|��d�dS)Nr�)r	r*�getvalue)r�bufr
r
r�assertNoStderr@szTest_TestCase.assertNoStderrcCsf|�t|�t|��xLt||�D]>\}}|�|tj�x&|��D]\}}|�t||�|�q@Wq WdS)N)r*r��zipro�loggingZ	LogRecord�items�getattr)r�records�matchesZrec�match�krr
r
r�assertLogRecordsFs
zTest_TestCase.assertLogRecordsc
Csd|���R|���}t�d�t�d�WdQRX|�|jdg�|�|j	ddig�WdQRXdS)N�1r�z
INFO:foo:1�namer
)
r6�
assertLogs�log_foo�info�
log_foobarrfr*�outputr?r;)rr�r
r
r�testAssertLogsDefaultsMs


z$Test_TestCase.testAssertLogsDefaultsc
Csv|���d|���$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jddiddig�WdQRXdS)	Nr@r��3z
INFO:foo:1zWARNING:quux:3rAr
r)r6rBrCrDrErf�log_quuxr)r*rFr?r;)rr�r
r
r�!testAssertLogsTwoMatchingMessagesVs



z/Test_TestCase.testAssertLogsTwoMatchingMessagesc
Csz|���h|j|d��$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jddidd	ig�WdQRXdS)
N)�levelr@r�rHzERROR:foo.bar:2zCRITICAL:quux:3rAzfoo.barr)r6rBrCr)rEr�rIZcriticalr*rFr?r;)rrKr�r
r
r�checkAssertLogsPerLevelas


z%Test_TestCase.checkAssertLogsPerLevelcCs|�tj�|�d�dS)N�ERROR)rLr8rM)rr
r
r�testAssertLogsPerLevellsz$Test_TestCase.testAssertLogsPerLevelcCs�|����|jdd��j}|j|dd��$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jdd	idd
ig�WdQRX|�|j	dg�WdQRXdS)N�DEBUG)rKr@r�rHz
INFO:foo:1zDEBUG:foo.bar:2rAr
zfoo.barzWARNING:quux:3)r6rBrCrDrErfrIr)r*rFr?r;)rZloggerZouter_cmr�r
r
r�checkAssertLogsPerLoggerps


z&Test_TestCase.checkAssertLogsPerLoggercCs|�t�d��|�d�dS)Nr
)rPr8�	getLogger)rr
r
r�testAssertLogsPerLogger~sz%Test_TestCase.testAssertLogsPerLoggercCsD|���2|�|j��|���WdQRXWdQRXWdQRXdS)N)r6r,r-rB)rr
r
r�testAssertLogsFailureNoLogs�s

z)Test_TestCase.testAssertLogsFailureNoLogscCsR|���@|�|j��(|jdd��t�d�WdQRXWdQRXWdQRXdS)NZWARNING)rKr@)r6r,r-rBrCrD)rr
r
r�!testAssertLogsFailureLevelTooHigh�s
z/Test_TestCase.testAssertLogsFailureLevelTooHighcCsV|jddd��>|�|j��&|�d��t�d�WdQRXWdQRXWdQRXdS)NrrM)rKr
r@)rBr,r-rIr�)rr
r
r�&testAssertLogsFailureMismatchingLogger�sz4Test_TestCase.testAssertLogsFailureMismatchingLoggercCs�|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|j	df|j
tdd�ff|jdf|j
td	d
d�td	d
dd
�ff|jtddd�ff|jdff}x.|D]&\}}|�t��||�WdQRXq�WdS)zY
        Test that the deprecated methods raise a DeprecationWarning. See #9424.
        )r(r�)r(r()g@g@)g@g@)TcSsddS)Ng��Q�	@Zspamr
)�_r
r
rr��rz9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)Fr5r))r�r�r()r�r�rcr
cSsidS)Nr
r
r
r
r
rr��r)r�r�N)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesr�failIfr�r�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrr�)r�oldZmethr�r
r
r�testDeprecatedMethodNames�s$z'Test_TestCase.testDeprecatedMethodNamesc
Cs\tjdd�dkrdSdddddd	d
dg}x,|D]$}|�t��t||�WdQRXq0WdS)z9Test that the deprecated fail* methods get removed in 3.xNr))r(r(rWrXrYrZr[r\r]r�)r��version_infor,r.r:)rZdeprecated_namesZdeprecated_namer
r
r�_testDeprecatedFailMethods�s
z(Test_TestCase._testDeprecatedFailMethodscCs&Gdd�dtj�}|d�}t|�dS)Nc@seZdZdd�ZdS)z0Test_TestCase.testDeepcopy.<locals>.TestableTestcSsdS)Nr
)rr
r
r�testNothing�sz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrrcr
r
r
r�TestableTest�srdrc)r$r%r)rrdrr
r
r�testDeepcopy�szTest_TestCase.testDeepcopycCsZt�d�}xJttjd�D]8}tj||d�}t�|�}|�||�|�t�t��qWdS)Nr/r5)�protocol)	r$r%r��pickleZHIGHEST_PROTOCOL�dumps�loadsr*r�)rrrfZ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�}x6||||fD]&}|�t��|d
���WdQRXq|WdS)NcSst�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
)rlr
r�Test1�srocseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N)rrrrrnr
)rlrmr
r�Test2�srpcseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N)rrrrnr!r
)rlrmr
r�Test3�srqcseZdZ�fdd�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4cs|���dS)N)r�)r)rlr
rrn�szATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingN)rrrrnr
)rlr
r�Test4�srrrn)N)r$r%r,rkr/)rrorprqrr�klassr
)rlrmr�testKeyboardInterrupt�s
z#Test_TestCase.testKeyboardInterruptcs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xJ||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�q|WdS)NcSst�d��dS)Nzsome reason)r$ZSkipTest)rr
r
r�_skip�sz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSsdS)Nr
)rr
r
rrm�sz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcseZdZ�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1N)rrrrnr
)rur
rro�srocseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2N)rrrrrnr
)rurmr
rrp�srpcseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3N)rrrrnr!r
)rurmr
rrqsrqcseZdZ�fdd�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cs|���dS)N)r�)r)rur
rrnszBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingN)rrrrnr
)rur
rrrsrrrnr5)N)r$r%r9r/r*r�Zskipped�testsRun)rrorprqrrrsr:r
)rurmr�testSkippingEverywhere�s
z$Test_TestCase.testSkippingEverywherecs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xJ||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�q|WdS)NcSst�dS)N)�
SystemExit)rr
r
rrlsz,Test_TestCase.testSystemExit.<locals>._raisecSsdS)Nr
)rr
r
rrmsz-Test_TestCase.testSystemExit.<locals>.nothingcseZdZ�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test1N)rrrrnr
)rlr
rrosrocseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test2N)rrrrrnr
)rlrmr
rrpsrpcseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test3N)rrrrnr!r
)rlrmr
rrqsrqcseZdZ�fdd�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test4cs|���dS)N)r�)r)rlr
rrn"sz:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingN)rrrrnr
)rlr
rrr!srrrnr5)N)r$r%r9r/r*r��errorsrv)rrorprqrrrsr:r
)rlrmr�testSystemExits
zTest_TestCase.testSystemExitc	Cs8t��}t�|�}t���~|�|��WdQRXdS)N)r$r%�weakref�refrZ
disable_gcr�)rr�Zwrr
r
r�testNoCycles+s


zTest_TestCase.testNoCyclescsZG�fdd�dt��G�fdd�dtj�}x*dD]"}||�}|��|��jd�q0WdS)Ncs(eZdZdZ�fdd�Z�fdd�ZdS)z9Test_TestCase.test_no_exception_leak.<locals>.MyExceptionrcs�jd7_t�|�dS)Nr5)�	ninstancerr)r)r'r
rr9szBTest_TestCase.test_no_exception_leak.<locals>.MyException.__init__cs�jd8_dS)Nr5)r~)r)r'r
r�__del__=szATest_TestCase.test_no_exception_leak.<locals>.MyException.__del__N)rrrr~rrr
)r'r
rr'6sr'cs*eZdZ�fdd�Zej�fdd��ZdS)z6Test_TestCase.test_no_exception_leak.<locals>.TestCasecs
���dS)Nr
)r)r'r
rrAsz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test1cs
���dS)Nr
)r)r'r
rrDsz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test2N)rrrrr$ZexpectedFailurerr
)r'r
rr%@sr%)rrr)rr$r%r/r*r~)rr%Zmethod_nameZtestcaser
)r'r�test_no_exception_leak3s

z$Test_TestCase.test_no_exception_leakN)rrrrrrZeq_pairsrZne_pairsr0r1r4r6r;rArDrErFrHrIrJrKrLrSrVrWrXrZr[r]rergrjrkrlrmrnrqrsrurxr{r$ZskipIfr�r��optimizer|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�rrrrrrrrrrr r!r&r-r.r1r2r3r��contextmanagerr6r?rGrJrLrNrPrRrSrTrUr`rbrerjrtrwrzrZcpython_onlyr}r�r
r
r
rr&9s�

		


	
	
%4($>(:L!
1!-	
r&�__main__)"r�r�r�rgrr�r8r�r{r'r�copyrrrr$Zunittest.test.supportrrrrrZtest.supportr	rQrCrErIr�rr%r&r�mainr
r
r
r�<module>sH


#