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.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@sDeZdZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)	�Testz5Keep these TestCase classes out of the main namespacec@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%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__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)	rrr�__doc__r r$rr'�
__classcell__rrr"rr(s
rN)	rrrr(�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+r2r3�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�failr9rrr�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+r2ZcountTestCases�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+�defaultTestResultr2�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
rr7r2�rr!rF�expectedrrLr�#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!rrrrrC�sz_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrHrIrrKrrr$�szSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrrCr$r)rrLr"rr�sr�startTestRunrMr$rNrO�stopTestRun�r
rr7r2�rr!rRrrLr�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�rrrJrrKrrr�szBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test�rrrrr)rrLr"rr�srrMr$rr'rNrOrPrQrrLr�"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�SrrTrrrrrC�sz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrZr\rrKrrr�szQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test�rrrrCrr)rrLr"rr�srrUrMr$rr'rNrOrVrWrXrrLr�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�dSrZ�rrr<rrKrrr�szDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.testr]rrLr"rr�srrMr$rr'�
addFailurerOrPrQrrLr�$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�SrrTrrrrrC�sz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���|�d�dSrZrarrKrrr�szSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.testr_rrLr"rr�srrUrMr$rr'rbrOrVrW)rrRr!rrLr�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'rJrrKrrr'szJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr'r)rrLr"rrsrrMr$rr'rNrOrPrQrrLr�&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�SrrTrrrrrCszbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcst�|���td��dSrerfrrKrrr'szYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrrCr'r)rrLr"rrsrrUrMr$rr'rNrOrVrWrXrrLr�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)rrrrrrC.szOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSsdSrrrrrrr0szBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrrCrrrrrr-srr)r*r+r7r@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?r1r0��ir?�failure�r1r0��j�r[r)rr�subTestr<rJ�rrkrorKrrr7s
 z;Test_TestCase._check_call_order__subtests.<locals>.Foo.testr]rrLr"rr6srrW�rrFr!Zexpected_eventsrrLr�_check_call_order__subtests5sz)Test_TestCase._check_call_order__subtestscCs8g}t|�}dddddddddddg}|�|||�dS)	NrMr$rr'�addSubTestFailure�addSubTestSuccessrNrO)rrtrQrrr�test_run_call_order__subtestsMs�z+Test_TestCase.test_run_call_order__subtestscCs.g}t|�}ddddddg}|�|||�dS)NrMr$rr'rbrO)rrtrQrrr�$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?r1rjrmrn)rrrqrrrKrrraszCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.testr]rrLr"rr`srrWrsrrLr�#_check_call_order__subtests_success_s	z1Test_TestCase._check_call_order__subtests_successcCs<g}t|�}ddddgddgddg}|�|||�dS)	NrMr$rr'rprv�
addSuccessrO)rryrQrrr�%test_run_call_order__subtests_successls
��z3Test_TestCase.test_run_call_order__subtests_successcCs.g}t|�}ddddddg}|�|||�dS)NrMr$rr'rzrO)rryrQrrr�,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?rjrlr1)rrrqr<rrKrrr�szFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.testr]rrLr"rr�srrMr$rr'rurO)r�failfastr
rr7r2rQrrLr�&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)rqr&r�r!rr�test_a�s
z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_ac	sJ|�����d�W5QRX|���|�d�W5QRX��d�dS)N�b1rlZb2)rqr&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rTrr�r�)r*r+rEr}Z	makeSuiter7r2)rrrFZsuiterRrr�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&rqrr�rrr��s

z5Test_TestCase.test_subtests_debug.<locals>.Foo.test_aN)rrrr�rr�rrr�srr�r�r�)r*r+�debugr2r@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+�assertIsr5�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)rJrrrrr�szRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN�rrrrrJr5rrrrr�srrrMrbrO�rr*r+r�r5rJr7r2�rr!rFrrRrrr�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�srrrMrbrOr�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.runTestNrBrrrrr�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.runTestNrBrrrrrsr)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.runTestNrBrrrrrsr)r*r+�assertIsInstancer3�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)�
defaultResultrrrC!szMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrrrCr�r�r!rrrsrrrUrMrzrOrV)rr*r+r7r�r2)rrrFrRrr�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+rEr7r�)rrrF�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�)rrF�ZresultInZ	resultOutrrr7DszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrrr7rr�rrr@srr)r*rEr+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.testShortDescriptionWithoutDocstringr1z)Docstrings are omitted with -O2 and abovecCs|�|��d�dS)z7Tests shortDescription() for a method with a docstring.N�r2r�rrrr�(testShortDescriptionWithOneLineDocstringPs�z6Test_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.Nr�rrrr�*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 firstNr�rrrr�&testShortDescriptionWhitespaceTrimmingfs�z4Test_TestCase.testShortDescriptionWhitespaceTrimmingcsVGdd�dt������}}|�||k�d�fdd�	}|��|�|�||�dS)Nc@seZdZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakez)Dummy class for test_addTypeEqualityFunc.N)rrrr(rrrr�SadSnakepsr�cs t|�t|�ko�kSSr)rD)�a�b�msg�r�rr�AllSnakesCreatedEqualtszDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqual)N)�object�assertFalseZaddTypeEqualityFuncr2)r�s1�s2r�rr�r�testAddTypeEqualityFuncosz%Test_TestCase.testAddTypeEqualityFunccCs,t�}|�||�|�|j|j|t��dSr)r�r�r4r5�r�thingrrr�testAssertIs|szTest_TestCase.testAssertIscCs,t�}|�|t��|�|j|j||�dSr)r�ZassertIsNotr4r5r�rrr�testAssertIsNot�szTest_TestCase.testAssertIsNotcCs(g}|�|t�|�|j|j|t�dSr)r��listr4r5�dictr�rrr�testAssertIsInstance�s�z"Test_TestCase.testAssertIsInstancecCs(g}|�|t�|�|j|j|t�dSr)ZassertNotIsInstancer�r4r5r�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��abcr1r?r0r��drZotter�x�Zelephantr�r�)�assertIn�assertNotInr4r5)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?r1�r�r��oner�)r�r��css|]}t|�VqdSr)�chr)�.0rkrrr�	<genexpr>�sz=Test_TestCase.testAssertDictContainsSubset.<locals>.<genexpr>�r
u�)	�warnings�catch_warnings�simplefilter�DeprecationWarning�assertDictContainsSubsetr4r5�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?r1�r0)�set�	frozensetr2r5r<r4)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�assertSequenceEqualr4r*r+r5�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?r1rz!assertSequenceEqual did not fail.)r2�maxDiffr��difflibZndiff�pprintZpformat�
splitlinesr*�case�DIFF_OMITTED�lenr�r5�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�r2)r�messager�rrr�testTruncateMessageFsz!Test_TestCase.testTruncateMessagec
Cspt�d�}dd�}||_z|�iddi�Wn4|jk
r`}z|�t|�d�W5d}~XYnX|�d�dS)Nr2cSsdSr�r�r�r�rrr�truncateVsz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncater?rr
zassertDictEqual did not fail)r*r+r�r�r5r2r�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)Nr2cSsdSr�rr�rrrr�bszATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncater
r�z!assertMultiLineEqual did not fail)r*r+r��assertMultiLineEqualr5r2r�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)r2r�r��
addCleanupr4r5r�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�rr4r5r2r�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?r1r0r
r�Zbaz�2r�T�d�
�r�rFr�y@y@r����ZaaabccdZabbbcce)r0r?r�)r?r0r�)r?rr�)rr?r�)
r��assertCountEqualr4r5�iter�divmodr�r�r*�utilZ_count_diff_all_purposer2Z_count_diff_hashable)rr�r�ZdiffsrRrrr�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?rm)r�r�)r��assertSetEqualr4r5r�)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)	Nr1r?g�������?g�?ZbugZantsbugsant)r�ZassertGreaterEqualr�ZassertLessEqualr4r5rrrr�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�r5r��splitr2�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?)r2r5r�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#r4r5r2ZassertNotEqualr�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�r4r5ZassertIsNotNonerrrr�testAssertIsNone�s

zTest_TestCase.testAssertIsNonecCs$|�dd�|�|j|jdd�dS)NZ
asdfabasdfzab+ZsaaasZaaaa)ZassertRegexr4r5rrrr�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>.ExceptionMockN�rrrrrrr�
ExceptionMock�sr-cs�d��dS�N�	We expectrr�r-rr�Stub�sz4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19���basecSsdS�Nrrrrrrr�rz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr4r;�intr5�	TypeError�rr1rr0r�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.rrr0rrr1�sz3Test_TestCase.testAssertRaisesContext.<locals>.Stubrr/r2r3r4r�r��*�r�)r7r4r;r�r	r2r�r8r5�assertRaisesRegexr9)rr1rrr0r�testAssertRaisesContext�s*z%Test_TestCase.testAssertRaisesContextc	Cs�|�t��|��W5QRX|�t��|�d�W5QRX|�t��|�t�W5QRX|�t��|�tdf�W5QRX|�t��|�ttf�W5QRXdS�Nr?)r4r9r�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'�getrefcountr4r;r2)rrBZrefcountrrr�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.rrr0rrr1$sz1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)r7r>�re�compiler4r9r:rr0r�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>r5r7rErFr9rrrr�testAssertNotRaisesRegex,s,��z&Test_TestCase.testAssertNotRaisesRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcNr,rrrr�MyExc@srJcSsdS�NTrrrrrrBrzATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)r7r4r9r>)rrJrrr�!testAssertRaisesRegexInvalidRegex>sz/Test_TestCase.testAssertRaisesRegexInvalidRegexcCs*Gdd�dt�}|�t|j|dd��dS)Nc@seZdZdS)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnNr,rrrr�MyWarnFsrMcSsdSrKrrrrrrHrz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr4r9r!)rrMrrr� 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�propertyrRrrrrrLsrr
z@foo@rPrR)�types�
ModuleTyper'rQ�assertWarns�UserWarningr��warnr@rrr�testAssertWarnsModifySysModulesJsz-Test_TestCase.testAssertWarnsModifySysModulesc	CsBdd�}|�|jd|jtd|�|�|jd|jtt�d�|�dS)NcSstd��dS)NZ
Unexpected)r7rrrrr1Ysz9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)r>r5r7rErFr:rrr�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
r0rrr1ksz4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)r7r4r	r�r2r�)rr1�v�ctxr�rr0r�testAssertRaisesExcValuegs
z&Test_TestCase.testAssertRaisesExcValuec	Cs�|�t��|��W5QRX|�t��|�t�W5QRX|�t��|�dd�W5QRX|�t��|�td�W5QRX|�t��|�tdfd�W5QRX|�t��|�ttfd�W5QRXdS�Nr?rH)r4r9r>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�rX�RuntimeWarningrrrr�
_runtime_warn�sz<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr
��categorycSsdSr6rrrrrr�rz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultr)
rVrar�r�rXr4r5r9r�r��rrbrrr�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`rrrrrb�sz;Test_TestCase.testAssertWarnsContext.<locals>._runtime_warnr?rr
�test_case.pyrcr�r�r<r=rer)�inspect�getsourcelinesrVrar�r��warningr2r�r��filename�linenor�rXr4r5r>r9r�r��rrbZ_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@)r4r9rVr�rWr7rrrr�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�rrrrb�szATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warn�o+�fooxcSsdSr6rrrrrr�rz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>re�barzr)	r!rar4r5r9r�r�r�r�rfrrr�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�rrrrbsz@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnr?rqrrrrhr�r�r<r=rersr)rirjr!rar�rkr2r�r�rlrmr4r5r>r9r�r�r�r�rnrrr�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^)r4r9r!rWr�r7rrrr�#testAssertWarnsRegexNoExceptionType,sz1Test_TestCase.testAssertWarnsRegexNoExceptionTypec	cs,t��}dVW5QRX|�|��d�dS)Nr�)r	r2�getvalue)r�bufrrr�assertNoStderr<szTest_TestCase.assertNoStderrcCs^|�t|�t|��t||�D]:\}}|�|tj�|��D]\}}|�t||�|�q<qdSr)r2r��zipr��logging�	LogRecord�items�getattr)r�records�matchesZrec�match�kr[rrr�assertLogRecordsBs
zTest_TestCase.assertLogRecordsc
Csd|���R|���}t�d�t�d�W5QRX|�|jdg�|�|j	ddig�W5QRXdS)N�1r�
INFO:foo:1�namer
)
ry�
assertLogs�log_foo�info�
log_foobarr�r2�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�ryr�r�r�r�r��log_quuxrkr2r�r�rr�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)ryr�r�rkr�rr��criticalr2r�r�r)rr�rrrr�checkAssertLogsPerLevel]s


�z%Test_TestCase.checkAssertLogsPerLevelcCs|�tj�|�d�dS)N�ERROR)r�r{r�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�r{�	getLoggerrrrr�testAssertLogsPerLoggerzsz%Test_TestCase.testAssertLogsPerLoggercCsD|���2|�|j��|���W5QRXW5QRXW5QRXdSr)ryr4r5r�rrrr�testAssertLogsFailureNoLogs~s

z)Test_TestCase.testAssertLogsFailureNoLogscCsR|���@|�|j��(|jdd��t�d�W5QRXW5QRXW5QRXdS)N�WARNINGr�r�)ryr4r5r�r�r�rrrr�!testAssertLogsFailureLevelTooHigh�s
z/Test_TestCase.testAssertLogsFailureLevelTooHighcCsV|jddd��>|�|j��&|�d��t�d�W5QRXW5QRXW5QRXdS)Nrr�r�r
r�)r�r4r5r�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)zY
        Test that the deprecated methods raise a DeprecationWarning. See #9424.
        )r0r��r0r0)�@r�)g@g@)TcSsddS)Ng��Q�	@Zspamr)�_rrrr�rz9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)Fr?r1r�r0)r�r�r�r
cSsidSr�rrrrrr�r)r�r�N)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesr9�failIfr�r�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrVr�)r�old�methr�rrr�testDeprecatedMethodNames�s&�z'Test_TestCase.testDeprecatedMethodNamesc
CsXtjdd�dkrdSdddddd	d
dg}|D]$}|�t��t||�W5QRXq.dS)z9Test that the deprecated fail* methods get removed in 3.xNr1r�r�r�r�r�r�r�r�r�)r'�version_infor4r6r~)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)Nr7r?)�protocol)	r*r+r��pickle�HIGHEST_PROTOCOL�dumps�loadsr2r�)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+r4r�r7)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+rEr7r2r�Zskipped�testsRun�rr�r�r�r�r�rFrr�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+rEr7r2r��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@)�	ninstancer7r 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)r7r*r+r7r2r�)rr+Zmethod_nameZtestcaserr-r�test_no_exception_leak/s
z$Test_TestCase.test_no_exception_leakN)rrrrr
rZeq_pairsrZne_pairsr8r:r=rArGrSrYr^r`rcrdrgrhrirtrwrxryr{r|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?rArDrGrIrLrOrYrZr]r_rgrorprtrurvr$�contextmanagerryr�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�rEr'r{r�r�rirT�copyrrrr*Zunittest.test.supportrrrrrZtest.supportr	r�r�r�r�r�r
r+r,r�mainrrrr�<module>sH




F1le Man4ger