Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/unittest/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/unittest/test/__pycache__/test_case.cpython-38.opt-2.pyc
U

@��gt�@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�foo�foo.bar�quuxc@s@eZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)�Testc@seZdZdd�Zdd�ZdS)zTest.FoocCsdS�N���selfrr�6/opt/cppython/lib/python3.8/unittest/test/test_case.py�runTest"�zTest.Foo.runTestcCsdSrrrrrr�test1#rzTest.Foo.test1N)�__name__�
__module__�__qualname__rrrrrr�Foo!src@seZdZdd�ZdS)zTest.BarcCsdSrrrrrr�test2&rzTest.Bar.test2N)rrrrrrrr�Bar%srcs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	zTest.LoggingTestCasecsttj|��d�||_dS�N�test)�superr
�LoggingTestCase�__init__�events)rr!��	__class__rrr +szTest.LoggingTestCase.__init__cCs|j�d�dS)N�setUp�r!�appendrrrrr$/szTest.LoggingTestCase.setUpcCs|j�d�dSrr%rrrrr2szTest.LoggingTestCase.testcCs|j�d�dS)N�tearDownr%rrrrr'5szTest.LoggingTestCase.tearDown)rrrr r$rr'�
__classcell__rrr"rr(srN)rrr�unittest�TestCaserrrrrrrr
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�W5QRX|�t��|��W5QRXdS)Nc@seZdZdd�Zdd�ZdS)z3Test_TestCase.test_init__no_test_name.<locals>.TestcSs
t��dSr��MyExceptionrrrrrUrz;Test_TestCase.test_init__no_test_name.<locals>.Test.runTestcSsdSrrrrrrrVrz8Test_TestCase.test_init__no_test_name.<locals>.Test.testN�rrrrrrrrrr
Tsr
i�z
.Test.runTest��)r)r*�assertEqual�id�assertRaises�failureException�AttributeError�run)rr
rrrr�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��dSrr,rrrrrjrz?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSsdSrrrrrrrkrz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testNr.rrrrr
isr
ri����z
.Test.test)r)r*r1r2�rr
rrr�test_init__test_name__validhsz)Test_TestCase.test_init__test_name__validcCsBGdd�dtj�}z|d�Wntk
r2YnX|�d�dS)Nc@seZdZdd�Zdd�ZdS)z9Test_TestCase.test_init__test_name__invalid.<locals>.TestcSs
t��dSrr,rrrrrurzATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSsdSrrrrrrrvrz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testNr.rrrrr
tsr
ZtestfoozFailed to raise ValueError)r)r*�
ValueError�failr8rrr�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>.FoocSsdSrrrrrrr�rz3Test_TestCase.test_countTestCases.<locals>.Foo.testN�rrrrrrrrr�srr�)r)r*r1ZcountTestCases�rrrrr�test_countTestCases�sz!Test_TestCase.test_countTestCasescCs2Gdd�dtj�}|���}|�t|�tj�dS)Nc@seZdZdd�ZdS)z1Test_TestCase.test_defaultTestResult.<locals>.FoocSsdSrrrrrrr�sz9Test_TestCase.test_defaultTestResult.<locals>.Foo.runTestN�rrrrrrrrr�sr)r)r*�defaultTestResultr1�type�
TestResult)rr�resultrrr�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$�RuntimeErrorr�rr#rrr$�szDTest_TestCase.test_run_call_order__error_in_setUp.<locals>.Foo.setUp)rrrr$r(r�rr"rr�sr�	startTestr$�addError�stopTest�rr
rr6r1�rr!rE�expectedrrKr�#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�Sr�rr!rrrrrB�sz_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrGrHrrJrrr$�szSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrrBr$r(rrKr"rr�sr�startTestRunrLr$rMrN�stopTestRun�r
rr6r1�rr!rQrrKr�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�N�raised by Foo.test�rrrIrrJrrr�szBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test�rrrrr(rrKr"rr�srrLr$rr'rMrNrOrPrrKr�"test_run_call_order__error_in_test�s�z0Test_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�SrrSrrrrrB�sz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrYr[rrJrrr�szQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test�rrrrBrr(rrKr"rr�srrTrLr$rr'rMrNrUrVrWrrKr�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�dSrY�rrr;rrJrrr�szDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.testr\rrKr"rr�srrLr$rr'�
addFailurerNrOrPrrKr�$test_run_call_order__failure_in_test�s�z2Test_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�SrrSrrrrrB�sz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���|�d�dSrYr`rrJrrr�szSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.testr^rrKr"rr�srrTrLr$rr'rarNrUrV)rrQr!rrKr�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'rIrrJrrr'szJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr'r(rrKr"rrsrrLr$rr'rMrNrOrPrrKr�&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�SrrSrrrrrBszbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrdrerrJrrr'szYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrrBr'r(rrKr"rrsrrTrLr$rr'rMrNrUrVrWrrKr�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�Sr)rrrrrrB.szOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSsdSrrrrrrr0szBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrrBrrrrrr-srr)r)r*r6r?rrr�"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�|���dD]d}|j|d��N|dkr6|�d�dD]0}|j|d��||dkr`td��W5QRXq:W5QRXqdd	dS)
N)r>r0r/��ir>�failure�r0r/��j�rZr)rr�subTestr;rI�rrjrnrJrrr7s
 z;Test_TestCase._check_call_order__subtests.<locals>.Foo.testr\rrKr"rr6srrV�rrEr!Zexpected_eventsrrKr�_check_call_order__subtests5sz)Test_TestCase._check_call_order__subtestscCs8g}t|�}dddddddddddg}|�|||�dS)	NrLr$rr'�addSubTestFailure�addSubTestSuccessrMrN)rrsrPrrr�test_run_call_order__subtestsMs�z+Test_TestCase.test_run_call_order__subtestscCs.g}t|�}ddddddg}|�|||�dS)NrLr$rr'rarN)rrsrPrrr�$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sVt�|���dD]>}|j|d��(dD]}|j|d��W5QRXq(W5QRXqdS)N)r>r0rirlrm)rrrprqrJrrraszCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.testr\rrKr"rr`srrVrrrrKr�#_check_call_order__subtests_success_s	z1Test_TestCase._check_call_order__subtests_successcCs<g}t|�}ddddgddgddg}|�|||�dS)	NrLr$rr'roru�
addSuccessrN)rrxrPrrr�%test_run_call_order__subtests_successls
��z3Test_TestCase.test_run_call_order__subtests_successcCs.g}t|�}ddddddg}|�|||�dS)NrLr$rr'ryrN)rrxrPrrr�,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�W5QRX|jdd��|�d�W5QRX|�d�dS)Nr>rirkr0)rrrpr;rrJrrr�szFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.testr\rrKr"rr�srrLr$rr'rtrN)r�failfastr
rr6r1rPrrKr�&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�W5QRX��d�dS)N�a1�a2)rpr&r�r!rr�test_a�s
z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_ac	sJ|�����d�W5QRX|���|�d�W5QRX��d�dS)N�b1rkZb2)rpr&r;rr�rr�test_b�s


z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_bcs��d�dS)N�c�r&rr�rr�test_c�sz8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_cN)rrrr�r�r�rr�rrr�srTr~rr�)r)r*rDr|Z	makeSuiter6r1)rrrEZsuiterQrr�r�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�W5QRXdS)N�	test case�	subtest 1)r&rprr�rrr��s

z5Test_TestCase.test_subtests_debug.<locals>.Foo.test_aN)rrrr�rr�rrr�srr�r�r�)r)r*�debugr1r?rr�r�test_subtests_debug�sz!Test_TestCase.test_subtests_debugcCs(Gdd�dtj�}|�|d�jt�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_failureException__default.<locals>.FoocSsdSrrrrrrr�sz>Test_TestCase.test_failureException__default.<locals>.Foo.testNr=rrrrr�srr)r)r*�assertIsr4�AssertionErrorr?rrr�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��dSr)rIrrrrr�szRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN�rrrrrIr4rrrrr�srrrLrarN�rr)r*r�r4rIr6r1�rr!rErrQrrr�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
)r;rrrrr�szRTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.Foo.testNr�rrrrr�srrrLrarNr�r�rrr�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>.FoocSsdSrrrrrrr�sz-Test_TestCase.test_setUp.<locals>.Foo.runTestNrArrrrr�sr)r)r*r$r?rrr�
test_setUp�szTest_TestCase.test_setUpcCs Gdd�dtj�}|���dS)Nc@seZdZdd�ZdS)z(Test_TestCase.test_tearDown.<locals>.FoocSsdSrrrrrrrsz0Test_TestCase.test_tearDown.<locals>.Foo.runTestNrArrrrrsr)r)r*r'r?rrr�
test_tearDown�szTest_TestCase.test_tearDowncCs(Gdd�dtj�}|�|���t�dS)Nc@seZdZdd�ZdS)z"Test_TestCase.test_id.<locals>.FoocSsdSrrrrrrrsz*Test_TestCase.test_id.<locals>.Foo.runTestNrArrrrrsr)r)r*�assertIsInstancer2�strr?rrr�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�dSrr�rr�rrrsz@Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.testcs�Srrr)�
defaultResultrrrB!szMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrrrBr�r�r!rrrsrrrTrLryrNrU)rr)r*r6r�r1)rrrErQrr�r� 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>.FoocSsdSrrrrrrr1sz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testNr=rrrrr0srr)r)r*rDr6r�)rrrE�retvalrrr�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>.FoocSsdSrrrrrrrAszPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|�|���Sr)r�)rrE�ZresultInZ	resultOutrrr6DszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrrr6rr�rrr@srr)r)rDr*r�)rrr�rr�r�0test_call__invoking_an_instance_delegates_to_run<s
z>Test_TestCase.test_call__invoking_an_instance_delegates_to_runcCs|�|���dSr)�assertIsNone�shortDescriptionrrrr�$testShortDescriptionWithoutDocstringMsz2Test_TestCase.testShortDescriptionWithoutDocstringr0z)Docstrings are omitted with -O2 and abovecCs|�|��d�dS)Nz7Tests shortDescription() for a method with a docstring.�r1r�rrrr�(testShortDescriptionWithOneLineDocstringPs�z6Test_TestCase.testShortDescriptionWithOneLineDocstringcCs|�|��d�dS)Nz>Tests shortDescription() for a method with a longer docstring.r�rrrr�*testShortDescriptionWithMultiLineDocstringXs	�z8Test_TestCase.testShortDescriptionWithMultiLineDocstringcCs|�|��d�dS)NzATests shortDescription() whitespace is trimmed, so that the firstr�rrrr�&testShortDescriptionWhitespaceTrimmingfs�z4Test_TestCase.testShortDescriptionWhitespaceTrimmingcsVGdd�dt������}}|�||k�d�fdd�	}|��|�|�||�dS)Nc@seZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakeN�rrrrrrr�SadSnakepsr�cs t|�t|�ko�kSSr)rC)�a�b�msg�r�rr�AllSnakesCreatedEqualtszDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqual)N)�object�assertFalseZaddTypeEqualityFuncr1)r�s1�s2r�rr�r�testAddTypeEqualityFuncosz%Test_TestCase.testAddTypeEqualityFunccCs,t�}|�||�|�|j|j|t��dSr)r�r�r3r4�r�thingrrr�testAssertIs|szTest_TestCase.testAssertIscCs,t�}|�|t��|�|j|j||�dSr)r�ZassertIsNotr3r4r�rrr�testAssertIsNot�szTest_TestCase.testAssertIsNotcCs(g}|�|t�|�|j|j|t�dSr)r��listr3r4�dictr�rrr�testAssertIsInstance�s�z"Test_TestCase.testAssertIsInstancecCs(g}|�|t�|�|j|j|t�dSr)ZassertNotIsInstancer�r3r4r�r�rrr�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��abcr0r>r/r��drZotter�x�Zelephantr�r�)�assertIn�assertNotInr3r4)rZanimalsrrr�testAssertIn�s"��zTest_TestCase.testAssertInc
Cs�t�����t�dt�|�ii�|�iddi�|�ddiddi�|�ddiddd��|�ddd�ddd��|�|j��|�ddii�W5QRX|�|j��|�ddiddi�W5QRX|�|j��|�ddiddi�W5QRX|�|j��|�ddd�ddi�W5QRX|�|j��|�ddd�ddi�W5QRXd	�d
d�td�D��}|�|j��|�d
|id
di�W5QRXW5QRXdS)N�ignorer�r>r0�r�r��oner�)r�r��css|]}t|�VqdSr)�chr)�.0rjrrr�	<genexpr>�sz=Test_TestCase.testAssertDictContainsSubset.<locals>.<genexpr>�r
u�)	�warnings�catch_warnings�simplefilter�DeprecationWarning�assertDictContainsSubsetr3r4�join�range)rr�rrr�testAssertDictContainsSubset�s(  z*Test_TestCase.testAssertDictContainsSubsetc	Cs�diifggft�t�ft�t�fg}|D]�\}}z|�||�Wn(|jk
rj|�d||f�YnXz|j||dd�Wn(|jk
r�|�d||f�YnXz|�||d�Wq*|jk
r�|�d||f�Yq*Xq*dgfit�ftdd	g�tdd
g�ftddg�td
dg�ftddg�tddg�fg}|D]L\}}|�|j|j||�|�|j|j||d�|j|j|j||dd��q@dS)
N)rrzassertEqual(%r, %r) failedr
�r�z$assertEqual(%r, %r) with msg= failedz/assertEqual(%r, %r) with third parameter failedrr�r>r0�r/)�set�	frozensetr1r4r;r3)rZequal_pairsr�r�Z
unequal_pairsrrr�testAssertEqual�sF

�����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)Nrrr�r>r�zThese are unequal)�assertListEqual�assertTupleEqual�assertSequenceEqualr3r)r*r4�tuple�extend�assertDictEqual�update)rr�r�r�r�rrr�testEquality�s�

�
�
�
�����
�

�zTest_TestCase.testEqualityc
Cs�|�|jd�ddd}ddd}d�t�t�|���t�|�����}tj	j
t|�df}t|�d|_z|�||�Wn.|j
k
r�}z|jd	}W5d}~XYnX|�d
�|�t|�t|��|�||�t|�d|_z|�||�Wn0|j
k
�r(}z|jd	}W5d}~XYnX|�d
�|�t|�t|��|�||�d|_z|�||�Wn0|j
k
�r�}z|jd	}W5d}~XYnX|�d
�|�t|�t|��|�||�dS)Ni�r�r�ir��
r>r0rz!assertSequenceEqual did not fail.)r1�maxDiffr��difflibZndiff�pprintZpformat�
splitlinesr)�case�DIFF_OMITTED�lenr�r4�argsr;�
assertLessr��
assertGreaterr�)rZseq1Zseq2�diff�omitted�er�rrr�testAssertSequenceEqualMaxDiffs>�


z,Test_TestCase.testAssertSequenceEqualMaxDiffcCsrd|_|�dd�}tjjtd�}|�|d|�d|_|�dd�}|�|d�d|_|�dd�}|�|d�dS)Nr>r
�bar�foobarr�)r��_truncateMessager)r�r�r�r1)r�messager�rrr�testTruncateMessageFsz!Test_TestCase.testTruncateMessagec
Cspt�d�}dd�}||_z|�iddi�Wn4|jk
r`}z|�t|�d�W5d}~XYnX|�d�dS)Nr1cSsdSr�r�r�r�rrr�truncateVsz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncater>rr
zassertDictEqual did not fail)r)r*r�r�r4r1r�r;�rrr�r�rrr�testAssertDictEqualTruncatesTs
"z*Test_TestCase.testAssertDictEqualTruncatesc
Cslt�d�}dd�}||_z|�dd�Wn4|jk
r\}z|�t|�d�W5d}~XYnX|�d�dS)Nr1cSsdSr�rr�rrrr�bszATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncater
r�z!assertMultiLineEqual did not fail)r)r*r��assertMultiLineEqualr4r1r�r;r�rrr�!testAssertMultiLineEqualTruncates`s
"z/Test_TestCase.testAssertMultiLineEqualTruncatesc	s0���jd�d�_�j�d�_����fdd��d}���j��}��|d|d�W5QRX��dt|j����|d|d�d	}d
d�}�j	�|�_	����fdd��|d|d}}���j��}��||�W5QRX��
dt|j����t|j�d
||f���|d|d�dS)Ni� cst�d��S�N�_diffThreshold��setattrr��
old_thresholdrrr�<lambda>urz=Test_TestCase.testAssertEqual_diffThreshold.<locals>.<lambda>Zxxxxxxxxxxxxxxxxr�r��^Z@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcSstd��dS)Nzthis should not be raised)�SystemError)r�r�rrr�explodingTruncation�szHTest_TestCase.testAssertEqual_diffThreshold.<locals>.explodingTruncationcst�d��S)Nr�r�r)�old_truncaterrrr�rz%r != %r)r1r�r��
addCleanupr3r4r�r��	exceptionr�r�)r�s�cmrr�r�r)rrrr�testAssertEqual_diffThresholdls*z+Test_TestCase.testAssertEqual_diffThresholdc	s\�j�d�_����fdd��d}|d|d}}���j��}��||�W5QRXd}��t|j�d||f���|d|d�d	}|d||d|}}���j��}��||�W5QRXd
}��t|j�d||||f�d}|d||d|}}���j��}��||�W5QRXd
}d}��t|j�d||||f�dS)Nrcst�d��Sr�r�rrrrr�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�rr3r4r1r�r	)rr
r�r�rr��pr�rrr�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)Nr>r0r/r
r�Zbaz�2r�T�d�
�r�rFr�y@y@r����ZaaabccdZabbbcce)r/r>r�)r>r/r�)r>rr�)rr>r�)
r��assertCountEqualr3r4�iter�divmodr�r�r)�utilZ_count_diff_all_purposer1Z_count_diff_hashable)rr�r�ZdiffsrQrrr�testAssertCountEqual�s� �

����(��$���
��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
)rr>rl)r�r�)r��assertSetEqualr3r4r�)rZset1Zset2rrr�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)	Nr0r>g�������?g�?ZbugZantsbugsant)r�ZassertGreaterEqualr�ZassertLessEqualr3r4rrrr�testInequalitysd�zTest_TestCase.testInequalityc
Csld}d}d}d|_z|�||�WnD|jk
rf}z$t|��dd�d}|�||�W5d}~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�r>)r�r�r4r��splitr1�rZsample_textZrevised_sample_textZsample_text_errorr��errorrrr�testAssertMultiLineEqualMsz&Test_TestCase.testAssertMultiLineEqualc
Csfd}d}d}z|�||�WnD|jk
r`}z$t|��dd�d}|�||�W5d}~XYnXdS)Nzladen swallows fly slowlyzunladen swallows fly quicklyzr- laden swallows fly slowly
?                    ^^^^
+ unladen swallows fly quickly
? ++                   ^^^^^
r�r>)r1r4r�rrrrr�testAssertEqualSingleLinelsz'Test_TestCase.testAssertEqualSingleLinec
sHtjjr�fdd�}ndd�}|��*���j����dd�W5QRXW5QRX|����dd�W5QRXddg}ddg}|��*���j����||�W5QRXW5QRX|��2���j����t	|�t	|��W5QRXW5QRX|��.���j����
|t	|��W5QRXW5QRX|��.���j����
t	|�|�W5QRXW5QRX|��*���j����
dd�W5QRXW5QRX|��2���j����t|�t|��W5QRXW5QRX���j����|t	|��W5QRX���j����t	|�|�W5QRXddg}dg}���j����||�W5QRX���j����t	|�t	|��W5QRX���j����
|t	|��W5QRX���j����
t	|�|�W5QRX���j����t|�t|��W5QRXdg}ddg}���j����||�W5QRX���j����t	|�t	|��W5QRX���j����
|t	|��W5QRX���j����
t	|�|�W5QRX���j����t|�t|��W5QRX|��2���j����
ddiddi�W5QRXW5QRX���j����
iddi�W5QRX���j����
ddii�W5QRX���j����ddgdddg�W5QRX|����ddgddg�W5QRX|��2���j����ddgddg�W5QRXW5QRX|��6���j����ddggddgg�W5QRXW5QRXdS)Ncs��td�S)Nz#Comparison between bytes and string)�assertWarnsRegex�BytesWarningrrrr�
bytes_warning~s�z=Test_TestCase.testEqualityBytesWarning.<locals>.bytes_warningcSst��Sr)�
contextlib�	ExitStackrrrrr#�sr��ar)�sys�flagsr#r3r4r1ZassertNotEqualr�r�r�r�rr�r�r)rr#r�r�rrr�testEqualityBytesWarning|s~  ($$ (( (z&Test_TestCase.testEqualityBytesWarningcCs<|�d�|�|j|jd�|�d�|�|j|jd�dS)NFzDjZoPloGears on Rails)r�r3r4ZassertIsNotNonerrrr�testAssertIsNone�s

zTest_TestCase.testAssertIsNonecCs$|�dd�|�|j|jdd�dS)NZ
asdfabasdfzab+ZsaaasZaaaa)ZassertRegexr3r4rrrr�testAssertRegex�s
�zTest_TestCase.testAssertRegexc	s�Gdd�dt���fdd�}|��|�|�t�f|�|jttddd�|�|j��|��dd	��W5QRX|�t��|��d�W5QRX|����|�t|�W5QRXdS)
Nc@seZdZdS)z=Test_TestCase.testAssertRaisesCallable.<locals>.ExceptionMockNr�rrrr�
ExceptionMock�sr,cs�d��dS�N�	We expectrr�r,rr�Stub�sz4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19���basecSsdS�Nrrrrrrr�rz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr3r:�intr4�	TypeError�rr0rr/r�testAssertRaisesCallable�sz&Test_TestCase.testAssertRaisesCallablec
sVGdd�dt���fdd�}|����|�W5QRX|�t�f��}|�W5QRX|�|j��|�|jjdd�|�t��tddd	�W5QRX|�|j��|����W5QRXW5QRX|�	|jd
�� |j�d
d��W5QRXW5QRX|�	t
d
�� |j�dd
��W5QRXW5QRX|����|�t|�W5QRXdS)Nc@seZdZdS)z<Test_TestCase.testAssertRaisesContext.<locals>.ExceptionMockNr�rrrrr,�sr,cs�d��dSr-rrr/rrr0�sz3Test_TestCase.testAssertRaisesContext.<locals>.Stubrr.r1r2r3r�r��*�r�)r6r3r:r�r	r1r�r7r4�assertRaisesRegexr8)rr0rrr/r�testAssertRaisesContext�s*z%Test_TestCase.testAssertRaisesContextc	Cs�|�t��|��W5QRX|�t��|�d�W5QRX|�t��|�t�W5QRX|�t��|�tdf�W5QRX|�t��|�ttf�W5QRXdS�Nr>)r3r8r�r:rrrr�testAssertRaisesNoExceptionTypesz-Test_TestCase.testAssertRaisesNoExceptionTypecCs4dd�}t�|�}|�t|�|�|t�|��dS)NcSs&zt�Wntk
r t�YnXdSr)r:rrrr�funcsz4Test_TestCase.testAssertRaisesRefcount.<locals>.func)r'�getrefcountr3r:r1)rrAZrefcountrrr�testAssertRaisesRefcounts
z&Test_TestCase.testAssertRaisesRefcountc	sfGdd�dt���fdd�}|��t�d�|�|��d|�|�t��|��dd�W5QRXdS)Nc@seZdZdS)z:Test_TestCase.testAssertRaisesRegex.<locals>.ExceptionMockNr�rrrrr,!sr,cs�d��dSr-rrr/rrr0$sz1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)r6r=�re�compiler3r8r9rr/r�testAssertRaisesRegex sz#Test_TestCase.testAssertRaisesRegexc
Cs�|�|jd|jtt�d�dd��|�|jd|jtddd��|�|jd��"|jtddd��W5QRXW5QRX|�td��"|jtdd	d
��W5QRXW5QRXdS)Nz"^Exception not raised by <lambda>$r�cSsdSrrrrrrr0rz8Test_TestCase.testAssertNotRaisesRegex.<locals>.<lambda>cSsdSrrrrrrr4rr��expectr�r;r<)r=r4r6rDrEr8rrrr�testAssertNotRaisesRegex,s,��z&Test_TestCase.testAssertNotRaisesRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcNr�rrrr�MyExc@srIcSsdS�NTrrrrrrBrzATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)r6r3r8r=)rrIrrr�!testAssertRaisesRegexInvalidRegex>sz/Test_TestCase.testAssertRaisesRegexInvalidRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnNr�rrrr�MyWarnFsrLcSsdSrJrrrrrrHrz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr3r8r!)rrLrrr� testAssertWarnsRegexInvalidRegexDsz.Test_TestCase.testAssertWarnsRegexInvalidRegexcCsLGdd�dtj�}|d�tjd<z|�ttjd�W5tjd=tjd=XdS)Nc@seZdZedd��ZdS)z:Test_TestCase.testAssertWarnsModifySysModules.<locals>.FoocSsdtjd<dS)Nr��@bar@)r'�modulesrrrr�__warningregistry__MszNTest_TestCase.testAssertWarnsModifySysModules.<locals>.Foo.__warningregistry__N)rrr�propertyrQrrrrrLsrr
z@foo@rOrQ)�types�
ModuleTyper'rP�assertWarns�UserWarningr��warnr?rrr�testAssertWarnsModifySysModulesJsz-Test_TestCase.testAssertWarnsModifySysModulesc	CsBdd�}|�|jd|jtd|�|�|jd|jtt�d�|�dS)NcSstd��dS)NZ
Unexpected)r6rrrrr0Ysz9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)r=r4r6rDrEr9rrr�testAssertRaisesRegexMismatchXs"��z+Test_TestCase.testAssertRaisesRegexMismatchc	sjGdd�dt���fdd�}d}|���}|�||�W5QRX|j}|�|��|�|jd|�dS)Nc@seZdZdS)z=Test_TestCase.testAssertRaisesExcValue.<locals>.ExceptionMockNr�rrrrr,hsr,cs�|��dSrr)r
r/rrr0ksz4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)r6r3r	r�r1r�)rr0�v�ctxr�rr/r�testAssertRaisesExcValuegs
z&Test_TestCase.testAssertRaisesExcValuec	Cs�|�t��|��W5QRX|�t��|�t�W5QRX|�t��|�dd�W5QRX|�t��|�td�W5QRX|�t��|�tdfd�W5QRX|�t��|�ttfd�W5QRXdS�Nr>rG)r3r8r=r:r�rrrr�$testAssertRaisesRegexNoExceptionTypevsz2Test_TestCase.testAssertRaisesRegexNoExceptionTypec
Csdd�}|�t|�|�t|�|�ttf|�|jttjdtd�|�|j��|�tdd��W5QRX|�t��|�td�W5QRXt���6t�	dt�|�|j��|�t|�W5QRXW5QRXt���4t�	dt�|�t��|�t|�W5QRXW5QRXdS)	NcSst�dt�dSr��r�rW�RuntimeWarningrrrr�
_runtime_warn�sz<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr
��categorycSsdSr5rrrrrr�rz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultr)
rUr`r�r�rWr3r4r8r�r��rrarrr�testAssertWarnsCallable�s*�
 
z%Test_TestCase.testAssertWarnsCallablecCsdd�}t�|�d}|�t��}|�W5QRX|�ttf��}|�W5QRX|�|jt�|�|jjdd�|�	d|j
�|�|j|d�|�t��|�|�W5QRX|�t��tj
dtd�W5QRX|�|j��|�t��W5QRXW5QRX|�|jd�� |jtdd	��W5QRXW5QRX|�td�� |jtd
d��W5QRXW5QRXt���Ft�dt�|�|j��"|�t��|�W5QRXW5QRXW5QRXt���Dt�d
t�|�t��"|�t��|�W5QRXW5QRXW5QRXdS)NcSst�dt�dSr�r_rrrrra�sz;Test_TestCase.testAssertWarnsContext.<locals>._runtime_warnr>rr
�test_case.pyrbr�r�r;r<rdr)�inspect�getsourcelinesrUr`r�r��warningr1r�r��filename�linenor�rWr3r4r=r8r�r��rraZ_runtime_warn_linenorrrr�testAssertWarnsContext�sD
$
z$Test_TestCase.testAssertWarnsContextc	Cs�|�t��|��W5QRX|�t��|�d�W5QRX|�t��|�t�W5QRX|�t��|�tdf�W5QRX|�t��|�ttf�W5QRX|�t��|�ttf�W5QRXdSr?)r3r8rUr�rVr6rrrr�testAssertWarnsNoExceptionType�sz,Test_TestCase.testAssertWarnsNoExceptionTypec
Cs&dd�}|�td|d�|�|j��|�tddd��W5QRX|�t��|�tdd�W5QRXt���:t�dt�|�|j��|�td|d�W5QRXW5QRX|�|j��|�td|d�W5QRXt���>t�d	t�|�t|jf��|�td|d�W5QRXW5QRXdS)
NcSst�|t�dSrr_r�rrrra�szATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warn�o+�fooxcSsdSr5rrrrrr�rz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>rd�barzr)	r!r`r3r4r8r�r�r�r�rerrr�testAssertWarnsRegexCallable�s<��
��
�z*Test_TestCase.testAssertWarnsRegexCallablecCsdd�}t�|�d}|�td��}|d�W5QRX|�|jt�|�|jjdd�|�d|j	�|�|j
|d�|�|j��|�td��W5QRXW5QRX|�
|jd��"|jtddd	��W5QRXW5QRX|�
td��"|jtdd
d��W5QRXW5QRXt���Jt�dt�|�|j��&|�td��|d�W5QRXW5QRXW5QRX|�|j��&|�td��|d
�W5QRXW5QRXt���Nt�dt�|�t|jf��&|�td��|d
�W5QRXW5QRXW5QRXdS)NcSst�|t�dSrr_r�rrrrasz@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnr>rprqrrgr�r�r;r<rdrrr)rhrir!r`r�rjr1r�r�rkrlr3r4r=r8r�r�r�r�rmrrr�testAssertWarnsRegexContexts<
&
z)Test_TestCase.testAssertWarnsRegexContextc	Cs�|�t��|��W5QRX|�t��|�t�W5QRX|�t��|�dd�W5QRX|�t��|�td�W5QRX|�t��|�tdfd�W5QRX|�t��|�ttfd�W5QRX|�t��|�ttfd�W5QRXdSr])r3r8r!rVr�r6rrrr�#testAssertWarnsRegexNoExceptionType,sz1Test_TestCase.testAssertWarnsRegexNoExceptionTypec	cs,t��}dVW5QRX|�|��d�dS)Nr�)r	r1�getvalue)r�bufrrr�assertNoStderr<szTest_TestCase.assertNoStderrcCs^|�t|�t|��t||�D]:\}}|�|tj�|��D]\}}|�t||�|�q<qdSr)r1r��zipr��logging�	LogRecord�items�getattr)r�records�matchesZrec�match�krZrrr�assertLogRecordsBs
zTest_TestCase.assertLogRecordsc
Csd|���R|���}t�d�t�d�W5QRX|�|jdg�|�|j	ddig�W5QRXdS)N�1r�
INFO:foo:1�namer
)
rx�
assertLogs�log_foo�info�
log_foobarr�r1�outputr�r~�rrrrr�testAssertLogsDefaultsIs


z$Test_TestCase.testAssertLogsDefaultsc
Csv|���d|���$}t�d�t�d�t�d�W5QRX|�|j	ddg�|�
|jddiddig�W5QRXdS)	Nr�r�3r��WARNING:quux:3r�r
r�rxr�r�r�r�r��log_quuxrjr1r�r�r~r�rrr�!testAssertLogsTwoMatchingMessagesRs



�z/Test_TestCase.testAssertLogsTwoMatchingMessagesc
Csz|���h|j|d��$}t�d�t�d�t�d�W5QRX|�|j	ddg�|�
|jddidd	ig�W5QRXdS)
N��levelr�rr�zERROR:foo.bar:2zCRITICAL:quux:3r�rr)rxr�r�rjr�rr��criticalr1r�r�r~)rr�rrrr�checkAssertLogsPerLevel]s


�z%Test_TestCase.checkAssertLogsPerLevelcCs|�tj�|�d�dS)N�ERROR)r�rzr�rrrr�testAssertLogsPerLevelhsz$Test_TestCase.testAssertLogsPerLevelcCs�|����|jdd��j}|j|dd��$}t�d�t�d�t�d�W5QRX|�|j	ddg�|�
|jdd	idd
ig�W5QRX|�|j	dg�W5QRXdS)N�DEBUGr�r�rr�r�zDEBUG:foo.bar:2r�r
rr�r�)r�loggerZouter_cmrrrr�checkAssertLogsPerLoggerls


�z&Test_TestCase.checkAssertLogsPerLoggercCs|�t�d��|�d�dSr�)r�rz�	getLoggerrrrr�testAssertLogsPerLoggerzsz%Test_TestCase.testAssertLogsPerLoggercCsD|���2|�|j��|���W5QRXW5QRXW5QRXdSr)rxr3r4r�rrrr�testAssertLogsFailureNoLogs~s

z)Test_TestCase.testAssertLogsFailureNoLogscCsR|���@|�|j��(|jdd��t�d�W5QRXW5QRXW5QRXdS)N�WARNINGr�r�)rxr3r4r�r�r�rrrr�!testAssertLogsFailureLevelTooHigh�s
z/Test_TestCase.testAssertLogsFailureLevelTooHighcCsV|jddd��>|�|j��&|�d��t�d�W5QRXW5QRXW5QRXdS)Nrr�r�r
r�)r�r3r4r�rrrrr�&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}|D]&\}}|�t��||�W5QRXq�dS)N)r/r��r/r/)�@r�)g@g@)TcSsddS)Ng��Q�	@Zspamr)�_rrrr�rz9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)Fr>r0r�r/)r�r�r�r
cSsidSr�rrrrrr�r)r�r�)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesr8�failIfr�r�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrUr�)r�old�methr�rrr�testDeprecatedMethodNames�s&�z'Test_TestCase.testDeprecatedMethodNamesc
CsXtjdd�dkrdSddddddd	d
g}|D]$}|�t��t||�W5QRXq.dS)Nr0r�r�r�r�r�r�r�r�r�)r'�version_infor3r5r})rZdeprecated_namesZdeprecated_namerrr�_testDeprecatedFailMethods�s�z(Test_TestCase._testDeprecatedFailMethodscCs&Gdd�dtj�}|d�}t|�dS)Nc@seZdZdd�ZdS)z0Test_TestCase.testDeepcopy.<locals>.TestableTestcSsdSrrrrrr�testNothing�sz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrr�rrrr�TestableTest�sr�r�)r)r*r)rr�rrrr�testDeepcopy�szTest_TestCase.testDeepcopycCsVt�d�}ttjd�D]8}tj||d�}t�|�}|�||�|�t�t��qdS)Nr6r>)�protocol)	r)r*r��pickle�HIGHEST_PROTOCOL�dumps�loadsr1r�)rrr�Zpickled_testZunpickled_testrrr�
testPickle�s

zTest_TestCase.testPicklec
s�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}||||fD]&}|�t��|d
���W5QRXqzdS)NcSst�dSr)�KeyboardInterruptrrrr�_raise�sz3Test_TestCase.testKeyboardInterrupt.<locals>._raisecSsdSrrrrrr�nothing�sz4Test_TestCase.testKeyboardInterrupt.<locals>.nothingcseZdZ�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test1N�rrr�test_somethingr�r�rr�Test1�sr�cseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N�rrrr$r�r�r�r�rr�Test2�sr�cseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N�rrrr�r'rr�rr�Test3�sr�cseZdZ�fdd�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4cs|���dSr�rrr�rrr��szATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingNr�rr�rr�Test4�sr�r�)N)r)r*r3r�r6)rr�r�r�r��klassrr�r�testKeyboardInterrupt�s
z#Test_TestCase.testKeyboardInterruptcs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�qzdS)NcSst�d��dS)Nzsome reason)r)ZSkipTestrrrr�_skip�sz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSsdSrrrrrrr��sz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcseZdZ�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1Nr�r�r�rrr��sr�cseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2Nr�r�r�r�rrr��sr�cseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3Nr�rr�rrr��sr�cseZdZ�fdd�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cs|���dSrr�rr�rrr�szBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingNr�rr�rrr�sr�r�r>)N)r)r*rDr6r1r�Zskipped�testsRun�rr�r�r�r�r�rErr�r�testSkippingEverywhere�s
z$Test_TestCase.testSkippingEverywherecs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�qzdS)NcSst�dSr)�
SystemExitrrrrr�
sz,Test_TestCase.testSystemExit.<locals>._raisecSsdSrrrrrrr�sz-Test_TestCase.testSystemExit.<locals>.nothingcseZdZ�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test1Nr�rr�rrr�sr�cseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test2Nr�rr�rrr�sr�cseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test3Nr�rr�rrr�sr�cseZdZ�fdd�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test4cs|���dSrr�rr�rrr�sz:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingNr�rr�rrr�sr�r�r>)N)r)r*rDr6r1r��errorsr�r�rr�r�testSystemExits
zTest_TestCase.testSystemExitc	Cs8t��}t�|�}t���~|�|��W5QRXdSr)r)r*�weakref�refrZ
disable_gcr�)rr��wrrrr�testNoCycles's


zTest_TestCase.testNoCyclescsVG�fdd�dt��G�fdd�dtj�}dD]"}||�}|��|��jd�q.dS)Ncs(eZdZdZ�fdd�Z�fdd�ZdS)z9Test_TestCase.test_no_exception_leak.<locals>.MyExceptionrcs�jd7_t�|�dSr?)�	ninstancer6r rr,rrr 5szBTest_TestCase.test_no_exception_leak.<locals>.MyException.__init__cs�jd8_dSr?)r�rr,rr�__del__9szATest_TestCase.test_no_exception_leak.<locals>.MyException.__del__N)rrrr�r r�rr,rrr-2sr-cs*eZdZ�fdd�Zej�fdd��ZdS)z6Test_TestCase.test_no_exception_leak.<locals>.TestCasecs
���dSrrrr,rrr=sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test1cs
���dSrrrr,rrr@sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test2N)rrrrr)ZexpectedFailurerrr,rrr*<sr*)rrr)r6r)r*r6r1r�)rr*Zmethod_nameZtestcaserr,r�test_no_exception_leak/s
z$Test_TestCase.test_no_exception_leakN)rrrrr
rZeq_pairsrZne_pairsr7r9r<r@rFrRrXr]r_rbrcrfrgrhrsrvrwrxrzr{r}r�r�r�r�r�r�r�r�r�r�r�r�r)ZskipIfr'r(�optimizer�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr r)r*r+r:r>r@rCrFrHrKrNrXrYr\r^rfrnrorsrtrur$�contextmanagerrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rZcpython_onlyr�r�rrrrr+9s��

		


	�
�
	
%4($>(:L 
0!,
	

r+�__main__)"r$r�r�r�rDr'rzr�r�rhrS�copyrrrr)Zunittest.test.supportrrrrrZtest.supportr	r�r�r�r�r�r
r*r+r�mainrrrr�<module>sH




F1le Man4ger