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.10/unittest/test/__pycache__/test_case.cpython-310.opt-2.pyc
o

�ig-�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlZddlmZmZmZmZmZddlmZmZe�d�Ze�d�Ze�d�ZGd	d
�d
e�ZGdd�dejee�Z e!d
kr~e�"�dSdS)�N)�deepcopy)�support)�TestEquality�TestHashing�
LoggingResult�LegacyLoggingResult�#ResultWithNoStartTestRunStopTestRun)�captured_stderr�
gc_collect�foo�foo.bar�quuxc@sBeZdZ	Gdd�dej�ZGdd�de�ZGdd�dej�ZdS)�Testc@�eZdZdd�Zdd�ZdS)zTest.FoocC�dS�N���selfrr�4/usr/local/lib/python3.10/unittest/test/test_case.py�runTest"�zTest.Foo.runTestcCrrrrrrr�test1#rzTest.Foo.test1N)�__name__�
__module__�__qualname__rrrrrr�Foo!�rc@�eZdZdd�ZdS)zTest.BarcCrrrrrrr�test2&rzTest.Bar.test2N)rrrrrrrr�Bar%�r cs6eZdZ	�fdd�Zdd�Zdd�Zdd�Z�ZS)	zTest.LoggingTestCasecsttj|��d�||_dS�N�test)�superr�LoggingTestCase�__init__�events)rr'��	__class__rrr&+s
zTest.LoggingTestCase.__init__cC�|j�d�dS)N�setUp�r'�appendrrrrr+/�zTest.LoggingTestCase.setUpcCr*r"r,rrrrr#2r.zTest.LoggingTestCase.testcCr*)N�tearDownr,rrrrr/5r.zTest.LoggingTestCase.tearDown)rrrr&r+r#r/�
__classcell__rrr(rr%(sr%N)rrr�unittest�TestCaserr r%rrrrrs
rc@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/e)�*e+j,j-dFkdG�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ÄZmd�dńZnd�dDŽZod�dɄZpd�d˄Zqd�d̈́Zrd�dτZsd�dфZtd�dӄZud�dՄZvd�dׄZwexjyd�dل�Zzd�dۄZ{d�S)��
Test_TestCaserrrcCs�Gdd�dtj�}|�|���dd�d�t��}|�dd�|�|j��|�dd�Wd�n1s7wY|�t��
|��Wd�dS1sQwYdS)Nc@r)z3Test_TestCase.test_init__no_test_name.<locals>.TestcS�t��r��MyExceptionrrrrrU�z;Test_TestCase.test_init__no_test_name.<locals>.Test.runTestcSrrrrrrrr#Vrz8Test_TestCase.test_init__no_test_name.<locals>.Test.testN�rrrrr#rrrrrTrri�z
.Test.runTest��)r1r2�assertEqual�id�assertRaises�failureException�AttributeError�run)rrr#rrr�test_init__no_test_nameSs�
"�z%Test_TestCase.test_init__no_test_namecCs2Gdd�dtj�}|�|d���dd�d�dS)Nc@r)z7Test_TestCase.test_init__test_name__valid.<locals>.TestcSr4rr5rrrrrjr7z?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSrrrrrrrr#krz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testNr8rrrrrirrr#i����z
.Test.test)r1r2r;r<�rrrrr�test_init__test_name__validhs z)Test_TestCase.test_init__test_name__validcCsBGdd�dtj�}z|d�Wn
tyYdSw|�d�dS)Nc@r)z9Test_TestCase.test_init__test_name__invalid.<locals>.TestcSr4rr5rrrrrur7zATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSrrrrrrrr#vrz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testNr8rrrrrtrrZtestfoozFailed to raise ValueError)r1r2�
ValueError�failrBrrr�test_init__test_name__invalidss�z+Test_TestCase.test_init__test_name__invalidcCs*Gdd�dtj�}|�|d���d�dS)Nc@r)z.Test_TestCase.test_countTestCases.<locals>.FoocSrrrrrrrr#�rz3Test_TestCase.test_countTestCases.<locals>.Foo.testN�rrrr#rrrrr�r!rr#�)r1r2r;ZcountTestCases�rrrrr�test_countTestCases�sz!Test_TestCase.test_countTestCasescCs2Gdd�dtj�}|���}|�t|�tj�dS)Nc@r)z1Test_TestCase.test_defaultTestResult.<locals>.FoocSrrrrrrrr��z9Test_TestCase.test_defaultTestResult.<locals>.Foo.runTestN�rrrrrrrrr�r!r)r1r2�defaultTestResultr;�type�
TestResult)rr�resultrrr�test_defaultTestResult�s
z$Test_TestCase.test_defaultTestResultc�Hg}t|�}G�fdd�dtj���|��|�gd�}|�||�dS)Nc�eZdZ��fdd�Z�ZS)z>Test_TestCase.test_run_call_order__error_in_setUp.<locals>.Fooc�t�|���td���Nzraised by Foo.setUp�r$r+�RuntimeErrorr�rr)rrr+��zDTest_TestCase.test_run_call_order__error_in_setUp.<locals>.Foo.setUp)rrrr+r0r�rr(rr��r)�	startTestr+�addError�stopTest�rrr%r@r;�rr'rP�expectedrrZr�#test_run_call_order__error_in_setUp�sz1Test_TestCase.test_run_call_order__error_in_setUpcs>g}G�fdd�dtj���|���gd�}|�||�dS)Nc�&eZdZdd�Z��fdd�Z�ZS)zMTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.FoocS�
t|j�Sr�rr'rrrrrM��
z_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcrTrUrVrrXrrr+�rYzSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrrMr+r0rrZr(rr��r)�startTestRunr\r+r]r^�stopTestRun�rr%r@r;�rr'rarrZr�2test_run_call_order__error_in_setUp_default_result�s
z@Test_TestCase.test_run_call_order__error_in_setUp_default_resultc�Hg}t|�}G�fdd�dtj��gd�}�|��|�|�||�dS)NcrS)z=Test_TestCase.test_run_call_order__error_in_test.<locals>.FoocrT�N�raised by Foo.test�r$r#rWrrXrrr#�rYzBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test�rrrr#r0rrZr(rr�r[r�r\r+r#r/r]r^r_r`rrZr�"test_run_call_order__error_in_test��z0Test_TestCase.test_run_call_order__error_in_testcs>g}G�fdd�dtj��gd�}�|���|�||�dS)Ncrc)zLTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.FoocSrdrrerrrrrM�rfz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcrTrnrprrXrrr#�rYzQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test�rrrrMr#r0rrZr(rr�rgr�rhr\r+r#r/r]r^rirjrkrrZr�1test_run_call_order__error_in_test_default_result�s
z?Test_TestCase.test_run_call_order__error_in_test_default_resultcrm)NcrS)z?Test_TestCase.test_run_call_order__failure_in_test.<locals>.Fooc�t�|���|�d�dSrn�r$r#rErrXrrr#��zDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.testrqrrZr(rr�r[r�r\r+r#r/�
addFailurer^r_r`rrZr�$test_run_call_order__failure_in_test�rtz2Test_TestCase.test_run_call_order__failure_in_testcs>G�fdd�dtj��gd�}g}�|���|�||�dS)Ncrc)zNTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.FoocSrdrrerrrrrM�rfz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcrxrnryrrXrrr#�rzzSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.testrurrZr(rr��r)rhr\r+r#r/r|r^rirj)rrar'rrZr�3test_run_call_order__failure_in_test_default_result�s
zATest_TestCase.test_run_call_order__failure_in_test_default_resultcrR)NcrS)zATest_TestCase.test_run_call_order__error_in_tearDown.<locals>.FoocrT�Nzraised by Foo.tearDown�r$r/rWrrXrrr/rYzJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr/r0rrZr(rrr[rrrr_r`rrZr�&test_run_call_order__error_in_tearDownsz4Test_TestCase.test_run_call_order__error_in_tearDowncs>G�fdd�dtj��g}�|���gd�}|�||�dS)Ncrc)zPTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.FoocSrdrrerrrrrMrfzbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcrTr�r�rrXrrr/rYzYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrrMr/r0rrZr(rrr~rrvrjrkrrZr�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@r)z=Test_TestCase.test_run_call_order_default_result.<locals>.FoocSst�Sr)rrrrrrM.�zOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSrrrrrrrr#0rKzBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrrMr#rrrrr-srr#)r1r2r@rIrrr�"test_run_call_order_default_result+sz0Test_TestCase.test_run_call_order_default_resultc�4G�fdd�dtj���|��|�|�||�dS)NcrS)z6Test_TestCase._check_call_order__subtests.<locals>.Foocs�t�|���dD]F}|j|d��6|dkr|�d�dD]"}|j|d��||dkr0td��Wd�n1s:wYqWd�n1sJwYq	dd	dS)
N�rHr:r9��irH�failure�r:r9��j�ror)r$r#�subTestrErW�rr�r�rXrrr#7s 
������z;Test_TestCase._check_call_order__subtests.<locals>.Foo.testrqrrZr(rr6r[rrj�rrPr'Zexpected_eventsrrZr�_check_call_order__subtests5sz)Test_TestCase._check_call_order__subtestscC�&g}t|�}gd�}|�|||�dS)N)r\r+r#r/�addSubTestFailure�addSubTestSuccessr�r�r�r]r^)rr�r`rrr�test_run_call_order__subtestsMsz+Test_TestCase.test_run_call_order__subtestscCr�)Nr{)rr�r`rrr�$test_run_call_order__subtests_legacyVsz2Test_TestCase.test_run_call_order__subtests_legacycr�)NcrS)z>Test_TestCase._check_call_order__subtests_success.<locals>.Foocs~t�|���dD]3}|j|d��#dD]}|j|d��Wd�n1s'wYqWd�n1s7wYq	dS)N)rHr:r�r�r�)r$r#r�r�rXrrr#as������zCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.testrqrrZr(rr`r[rrjr�rrZr�#_check_call_order__subtests_success_s	z1Test_TestCase._check_call_order__subtests_successcCs8g}t|�}gd�ddgddg}|�|||�dS)N)r\r+r#r/r�r��
addSuccessr^)rr�r`rrr�%test_run_call_order__subtests_successls��z3Test_TestCase.test_run_call_order__subtests_successcCr�)N)r\r+r#r/r�r^)rr�r`rrr�,test_run_call_order__subtests_success_legacyvsz:Test_TestCase.test_run_call_order__subtests_success_legacycsNg}t|�}d|_G�fdd�dtj��gd�}�|��|�|�||�dS)NTcrS)zATest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foocs�t�|���|jdd��
|�d�Wd�n1swY|jdd��
|�d�Wd�n1s8wY|�d�dS)NrHr�r�r:)r$r#r�rErrXrrr#�s��zFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.testrqrrZr(rr�r[r)r\r+r#r/r�r^)r�failfastrr%r@r;r`rrZr�&test_run_call_order__subtests_failfast~s	z4Test_TestCase.test_run_call_order__subtests_failfastcsTg�G�fdd�dtj�}t��}d|_t�|�}|�|�gd�}|��|�dS)Ncs0eZdZ�fdd�Z�fdd�Z�fdd�ZdS)z1Test_TestCase.test_subtests_failfast.<locals>.Foocs@|���
��d�Wd�n1swY��d�dS)N�a1�a2)r�r-r�r'rr�test_a�s
�z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_acsr|���
��d�Wd�n1swY|���
|�d�Wd�n1s-wY��d�dS)N�b1r��b2)r�r-rErr�rr�test_b�s
�
�z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_bc���d�dS)N�c�r-rr�rr�test_c��z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_cN)rrrr�r�r�rr�rrr�srT)r�r�r�)r1r2rOr�Z	makeSuiter@r;)rrrPZsuiterarr�r�test_subtests_failfast�s

z$Test_TestCase.test_subtests_failfastcs:g�G�fdd�dtj�}|d���|��ddg�dS)Nc�eZdZ�fdd�ZdS)z.Test_TestCase.test_subtests_debug.<locals>.FoocsB��d�|�����d�Wd�dS1swYdS)N�	test case�	subtest 1)r-r�rr�rrr��s

"�z5Test_TestCase.test_subtests_debug.<locals>.Foo.test_aN)rrrr�rr�rrr��rr�r�r�)r1r2�debugr;rIrr�r�test_subtests_debug�sz!Test_TestCase.test_subtests_debugcCs(Gdd�dtj�}|�|d�jt�dS)Nc@r)z9Test_TestCase.test_failureException__default.<locals>.FoocSrrrrrrrr#�rKz>Test_TestCase.test_failureException__default.<locals>.Foo.testNrGrrrrr�r!rr#)r1r2�assertIsr>�AssertionErrorrIrrr�test_failureException__default��z,Test_TestCase.test_failureException__defaultcC�Vg}t|�}Gdd�dtj�}|�|d�jt�|d��|�gd�}|�||�dS)Nc@�eZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.FoocSr4r)rWrrrrr#�r�zRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN�rrrr#rWr>rrrrr��rr#�r\r|r^�rr1r2r�r>rWr@r;�rr'rPrrarrr�2test_failureException__subclassing__explicit_raise��z@Test_TestCase.test_failureException__subclassing__explicit_raisecCr�)Nc@r�)zMTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.FoocSs|�d�dS�Nr)rErrrrr#�r�zRTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.Foo.testNr�rrrrr�r�rr#r�r�r�rrr�2test_failureException__subclassing__implicit_raise�r�z@Test_TestCase.test_failureException__subclassing__implicit_raisecC� Gdd�dtj�}|���dS)Nc@r)z%Test_TestCase.test_setUp.<locals>.FoocSrrrrrrrr�rKz-Test_TestCase.test_setUp.<locals>.Foo.runTestNrLrrrrr�r!r)r1r2r+rIrrr�
test_setUp��zTest_TestCase.test_setUpcCr�)Nc@r)z(Test_TestCase.test_tearDown.<locals>.FoocSrrrrrrrrrKz0Test_TestCase.test_tearDown.<locals>.Foo.runTestNrLrrrrrr!r)r1r2r/rIrrr�
test_tearDown�r�zTest_TestCase.test_tearDowncCs(Gdd�dtj�}|�|���t�dS)Nc@r)z"Test_TestCase.test_id.<locals>.FoocSrrrrrrrrrKz*Test_TestCase.test_id.<locals>.Foo.runTestNrLrrrrrr!r)r1r2�assertIsInstancer<�strrIrrr�test_id
r�zTest_TestCase.test_idcsTg�t���G��fdd�dtj�}|d���}|�|��gd�}|��|�dS)Ncs$eZdZ�fdd�Z�fdd�ZdS)z;Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foocr�r"r�rr�rrr#r�z@Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.testcs�Srrr)�
defaultResultrrrM!rKzMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrr#rMr�r�r'rrrsrr#)rhr\r#r�r^ri)rr1r2r@r�r;)rrrPrarr�r� test_run__uses_defaultTestResultsz.Test_TestCase.test_run__uses_defaultTestResultcCs8Gdd�dtj�}t��}|d��|�}|�||�dS)Nc@r)z9Test_TestCase.test_run__returns_given_result.<locals>.FoocSrrrrrrrr#1rKz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testNrGrrrrr0r!rr#)r1r2rOr@r�)rrrP�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>.FoocSrrrrrrrr#ArKzPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|�|���Sr)r�)rrP�ZresultInZ	resultOutrrr@DszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrr#r@rr�rrr@srr#)r1rOr2r�)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�$testShortDescriptionWithoutDocstringM�z2Test_TestCase.testShortDescriptionWithoutDocstringr:z)Docstrings are omitted with -O2 and abovecC�	|�|��d�dS)Nz7Tests shortDescription() for a method with a docstring.�r;r�rrrr�(testShortDescriptionWithOneLineDocstringPs
�z6Test_TestCase.testShortDescriptionWithOneLineDocstringcCr�)Nz>Tests shortDescription() for a method with a longer docstring.r�rrrr�*testShortDescriptionWithMultiLineDocstringXs
�z8Test_TestCase.testShortDescriptionWithMultiLineDocstringcCr�)NzATests shortDescription() whitespace is trimmed, so that the firstr�rrrr�&testShortDescriptionWhitespaceTrimmingfs
�z4Test_TestCase.testShortDescriptionWhitespaceTrimmingcsVGdd�dt������}}|�||k�d�fdd�	}|��|�|�||�dS)Nc@�eZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakeN�rrrrrrr�SadSnaker�r�cs t|�t|�ko
�kSSr)rN)�a�b�msg�r�rr�AllSnakesCreatedEqualvs zDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqualr)�object�assertFalseZaddTypeEqualityFuncr;)r�s1�s2r�rr�r�testAddTypeEqualityFuncqsz%Test_TestCase.testAddTypeEqualityFunccCs,t�}|�||�|�|j|j|t��dSr)r�r�r=r>�r�thingrrr�testAssertIs~szTest_TestCase.testAssertIscCs,t�}|�|t��|�|j|j||�dSr)r�ZassertIsNotr=r>r�rrr�testAssertIsNot�szTest_TestCase.testAssertIsNotcC�(g}|�|t�|�|j|j|t�dSr)r��listr=r>�dictr�rrr�testAssertIsInstance��
�z"Test_TestCase.testAssertIsInstancecCr�r)ZassertNotIsInstancer�r=r>r�r�rrr�testAssertNotIsInstance�r�z%Test_TestCase.testAssertNotIsInstancecCs�dddd�}|�dd�|�dgd��|�d	|�|�d
d�|�dgd��|�d|�|�|j|jd
d�|�|j|jdgd��|�|j|jd|�|�|j|jdd�|�|j|jdgd��|�|j|jd|�dS)NZbananaZgrassZfish)�monkey�cowZsealr��abcr:r�r��drZotter�x�Zelephantr�rHr�)�assertIn�assertNotInr=r>)rZanimalsrrr�testAssertIn�s"��zTest_TestCase.testAssertInc	Cs�t����
t�dt�|�ii�|�iddi�|�ddiddi�|�ddiddd��|�ddd�ddd��|�|j��|�ddii�Wd�n1sTwY|�|j��|�ddiddi�Wd�n1stwY|�|j��|�ddiddi�Wd�n1s�wY|�|j��|�ddd�ddi�Wd�n1s�wY|�|j��|�ddd�ddi�Wd�n1s�wYd	�d
d�td�D��}|�|j��|�d
|id
di�Wd�n	1�swYWd�n	1�swY|�	t��}|�ii�Wd�n	1�s/wY|�
|jdjt�dS)N�ignorer�rHr:�r�r��oner�)r�r��css�|]}t|�VqdSr)�chr)�.0r�rrr�	<genexpr>�s�z=Test_TestCase.testAssertDictContainsSubset.<locals>.<genexpr>�ru�r)
�warnings�catch_warnings�simplefilter�DeprecationWarning�assertDictContainsSubsetr=r>�join�range�assertWarnsr;�filename�__file__)rr�Zwarninforrr�testAssertDictContainsSubset�s@���������z*Test_TestCase.testAssertDictContainsSubsetc	Cs�diifggft�t�ft�t�fg}|D]Z\}}z|�||�Wn|jy4|�d||f�Ynwz
|j||dd�Wn|jyR|�d||f�Ynwz	|�||d�Wq|jyo|�d||f�Yqwdgfit�ftdd	g�tdd
g�ftddg�td
dg�ftddg�tddg�fg}|D]%\}}|�|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�rHr:�r9)�set�	frozensetr;r>rEr=)rZequal_pairsr�r�Z
unequal_pairsrrr�testAssertEqual�sN

���
������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�rHr�zThese are unequal)�assertListEqual�assertTupleEqual�assertSequenceEqualr=r1r2r>�tuple�extend�assertDictEqual�update)rr�r�r�r�rrr�testEquality�sh

�
�
�
�����
�


�zTest_TestCase.testEqualityc
Cs�|�|jd�ddd}ddd}d�t�t�|���t�|�����}tj	j
t|�df}t|�d|_z|�||�Wn|j
yX}z|jd	}WYd}~n
d}~ww|�d
�|�t|�t|��|�||�t|�d|_z|�||�Wn|j
y�}z|jd	}WYd}~n
d}~ww|�d
�|�t|�t|��|�||�d|_z|�||�Wn|j
y�}z|jd	}WYd}~n
d}~ww|�d
�|�t|�t|��|�||�dS)Ni�r�r�ir��
rHr:rz!assertSequenceEqual did not fail.)r;�maxDiffr�difflibZndiff�pprintZpformat�
splitlinesr1�case�DIFF_OMITTED�lenrr>�argsrE�
assertLessr��
assertGreaterr�)rZseq1Zseq2�diff�omitted�er�rrr�testAssertSequenceEqualMaxDiff$sJ���
��
��
z,Test_TestCase.testAssertSequenceEqualMaxDiffcCsrd|_|�dd�}tjjtd�}|�|d|�d|_|�dd�}|�|d�d|_|�dd�}|�|d�dS)NrHr�bar�foobarr�)r�_truncateMessager1rrrr;)r�messager$rrr�testTruncateMessageLsz!Test_TestCase.testTruncateMessagec
Cstt�d�}dd�}||_z
|�iddi�Wn|jy2}z|�t|�d�WYd}~dSd}~ww|�d�dS)Nr;cS�dSr�r�r�r#rrr�truncate\rKz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncaterHrrzassertDictEqual did not fail)r1r2r)rr>r;r�rE�rr#r.r%rrr�testAssertDictEqualTruncatesZs
��z*Test_TestCase.testAssertDictEqualTruncatesc
Cspt�d�}dd�}||_z|�dd�Wn|jy0}z|�t|�d�WYd}~dSd}~ww|�d�dS)Nr;cSr,r�rr-rrrr.hrKzATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncaterr'z!assertMultiLineEqual did not fail)r1r2r)�assertMultiLineEqualr>r;r�rEr/rrr�!testAssertMultiLineEqualTruncatesfs
��z/Test_TestCase.testAssertMultiLineEqualTruncatescsX���jd�d�_�j�d�_����fdd��d}���j��}��|d|d�Wd�n1s7wY��dt|j����|d|d�d	}d
d�}�j	�|�_	����fdd��|d|d}}���j��}��||�Wd�n1s�wY��
dt|j����t|j�d
||f���|d|d�dS)Ni� c�t�d��S�N�_diffThreshold��setattrr��
old_thresholdrrr�<lambda>{�z=Test_TestCase.testAssertEqual_diffThreshold.<locals>.<lambda>Zxxxxxxxxxxxxxxxxr�r��^Z@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcS�td��)Nzthis should not be raised)�SystemError)r*r#rrr�explodingTruncation��zHTest_TestCase.testAssertEqual_diffThreshold.<locals>.explodingTruncationcr4)Nr)r7r)�old_truncaterrrr;�r<z%r != %r)r;r6r�
addCleanupr=r>r�r��	exceptionr)r�)r�s�cmr@r�r�r)r:rBrr�testAssertEqual_diffThresholdrs.��z+Test_TestCase.testAssertEqual_diffThresholdcs��j�d�_����fdd��d}|d|d}}���j��}��||�Wd�n1s2wYd}��t|j�d||f���|d|d�d	}|d||d|}}���j��}��||�Wd�n1svwYd
}��t|j�d||||f�d}|d||d|}}���j��}��||�Wd�n1s�wYd
}d}��t|j�d||||f�dS)Nrcr4r5r7rr9rrr;�r<z7Test_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)r6rCr=r>r;r�rD)rrEr�r�rFr��pr�rr9r�testAssertEqual_shorten�s4���"z%Test_TestCase.testAssertEqual_shortencCs�t�}|�gd�gd��|�gd�gd��|�||dddg|dd|df�|�gd�gd��|�|j|jd	dgdgd
d	gd
ddg�|�|j|jgd�gd��|�|j|jdgdd
g�|�|j|jdd
gdg�|�|j|jgd�dd
g�|�d	dgddgdgdddgd	dgg�|�td	dgddg�td	dgddg��|�|j|jgtdd	ddt�g�|�dd	iddigddidd	ig�|�d	dtggtgdd	g�|�|j|jgtgdd	ddt�g�|�|j|jd	ggdgg�|�|j|jgd�dd	g�|�|j|jgd�gd��|�|j|jd	ddiddgddiddg�ddhd	dhg}|ddd�}|�||�ttj	�
dd��}hd�}|�||�tj	�
ggg�}|�|d	dgfg�ttj	�dd��}hd�}|�||�dS)Nr�)r9r:rH)rr'�baz)r'rJrr:r9)rH�2r�r�)r�rKTr�rH�d)r�rKTrH�
�)rMrNrMr�rFr�y@y@r�r�)rHrHr:)rHrHrKr�r�)rKrKTr�T���ZaaabccdZabbbcce>)rHr9r�)r9rHr�)rrHr%)rHrr�)
r��assertCountEqualr=r>�iter�divmodrr
r1�utilZ_count_diff_all_purposer;Z_count_diff_hashable)rr�r�Zdiffsrarrr�testAssertCountEqual�sn  ��
�
��(��$�����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)rrHr�)r�r)r
�assertSetEqualr=r>r)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)	Nr:rHg�������?g�?ZbugZantsbugsant)r"ZassertGreaterEqualr!ZassertLessEqualr=r>rrrr�testInequalitysd�zTest_TestCase.testInequalityc
Csnd}d}d}d|_z	|�||�WdS|jy6}zt|��dd�d}|�||�WYd}~dSd}~ww)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.
rrH)rr1r>r��splitr;�rZsample_textZrevised_sample_textZsample_text_errorr%�errorrrr�testAssertMultiLineEqualSs��z&Test_TestCase.testAssertMultiLineEqualc
Cshd}d}d}z	|�||�WdS|jy3}zt|��dd�d}|�||�WYd}~dSd}~ww)Nzladen swallows fly slowlyzunladen swallows fly quicklyzr- laden swallows fly slowly
?                    ^^^^
+ unladen swallows fly quickly
? ++                   ^^^^^
rrH)r;r>r�rXrYrrr�testAssertEqualSingleLiners��z'Test_TestCase.testAssertEqualSingleLinec	sttjjr�fdd�}ndd�}|��$���j����dd�Wd�n1s*wYWd�n1s9wY|����dd�Wd�n1sRwYddg}ddg}|��$���j����||�Wd�n1szwYWd�n1s�wY|��(���j����t	|�t	|��Wd�n1s�wYWd�n1s�wY|��&���j����
|t	|��Wd�n1s�wYWd�n1s�wY|��'���j����
t	|�|�Wd�n	1�swYWd�n	1�s wY|��%���j����
dd�Wd�n	1�sAwYWd�n	1�sQwY|��)���j����t|�t|��Wd�n	1�svwYWd�n	1�s�wY���j����|t	|��Wd�n	1�s�wY���j����t	|�|�Wd�n	1�s�wYddg}dg}���j����||�Wd�n	1�s�wY���j����t	|�t	|��Wd�n	1�s	wY���j����
|t	|��Wd�n	1�s(wY���j����
t	|�|�Wd�n	1�sGwY���j����t|�t|��Wd�n	1�shwYdg}ddg}���j����||�Wd�n	1�s�wY���j����t	|�t	|��Wd�n	1�s�wY���j����
|t	|��Wd�n	1�s�wY���j����
t	|�|�Wd�n	1�s�wY���j����t|�t|��Wd�n	1�swY|��)���j����
ddiddi�Wd�n	1�s1wYWd�n	1�sAwY���j����
iddi�Wd�n	1�s`wY���j����
ddii�Wd�n	1�swY���j����ddggd��Wd�n	1�s�wY|����ddgddg�Wd�n	1�s�wY|��)���j����ddgddg�Wd�n	1�s�wYWd�n	1�s�wY|��4���j����ddggddgg�Wd�n1�swYWd�dSWd�dS1�s3wYdS)Ncs��td�S)Nz#Comparison between bytes and string)�assertWarnsRegex�BytesWarningrrrr�
bytes_warning�s�z=Test_TestCase.testEqualityBytesWarning.<locals>.bytes_warningcSst��Sr)�
contextlib�	ExitStackrrrrr_�rAr��ar)rbrbrb)�sys�flagsr_r=r>r;ZassertNotEqualrrrrrUr
rrP)rr_r�r�rrr�testEqualityBytesWarning�s������������������������������������T�z&Test_TestCase.testEqualityBytesWarningcCs<|�d�|�|j|jd�|�d�|�|j|jd�dS)NFzDjZoPloGears on Rails)r�r=r>ZassertIsNotNonerrrr�testAssertIsNone�s

zTest_TestCase.testAssertIsNonecCs$|�dd�|�|j|jdd�dS)NZ
asdfabasdfzab+ZsaaasZaaaa)ZassertRegexr=r>rrrr�testAssertRegex�s�zTest_TestCase.testAssertRegexcs�Gdd�dt���fdd�}|��|�|�t�f|�|jttddd�|�|j��|��dd	��Wd�n1s>wY|�t��|��d�Wd�n1sYwY|����|�t|�Wd�dS1suwYdS)
Nc@r�)z=Test_TestCase.testAssertRaisesCallable.<locals>.ExceptionMockNr�rrrr�
ExceptionMock�r�rhc��d���N�	We expectrr�rhrr�Stub�rAz4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19���basecSr,�Nrrrrrrr;�rz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr=rD�intr>�	TypeError�rrmrrlr�testAssertRaisesCallable�s��"�z&Test_TestCase.testAssertRaisesCallablec	s"Gdd�dt���fdd�}|����|�Wd�n1s!wY|�t�f��}|�Wd�n1s;wY|�|j��|�|jjdd�|�t��tddd	�Wd�n1sgwY|�|j��|����Wd�n1s�wYWd�n1s�wY|�	|jd
��|j�d
d��Wd�n1s�wYWd�n1s�wY|�	t
d
��|j�dd
��Wd�n1s�wYWd�n1s�wY|����|�t|�Wd�dS1�s
wYdS)Nc@r�)z<Test_TestCase.testAssertRaisesContext.<locals>.ExceptionMockNr�rrrrrh�r�rhcrirjrrrlrrrm�rAz3Test_TestCase.testAssertRaisesContext.<locals>.Stubrrkrnrorpr(r�*�r()rsr=rDr�rDr;r rtr>�assertRaisesRegexru)rrmrFrrlr�testAssertRaisesContext�sD������������$�z%Test_TestCase.testAssertRaisesContextcCs|�t��|��Wd�n1swY|�t��
|�d�Wd�n1s.wY|�t��
|�t�Wd�n1sHwY|�t��|�tdf�Wd�n1sdwY|�t��|�ttf�Wd�dS1s�wYdS�NrH)r=rur�rDrrrr�testAssertRaisesNoExceptionType
s
����"�z-Test_TestCase.testAssertRaisesNoExceptionTypecCs4dd�}t�|�}|�t|�|�|t�|��dS)NcSszt�tyt�wr)rDrrrr�funcs
�z4Test_TestCase.testAssertRaisesRefcount.<locals>.func)rc�getrefcountr=rDr;)rr~Zrefcountrrr�testAssertRaisesRefcounts
z&Test_TestCase.testAssertRaisesRefcountcs|Gdd�dt���fdd�}|��t�d�|�|��d|�|�t��|��dd�Wd�dS1s7wYdS)Nc@r�)z:Test_TestCase.testAssertRaisesRegex.<locals>.ExceptionMockNr�rrrrrh'r�rhcrirjrrrlrrrm*rAz1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)rsrz�re�compiler=rurvrrlr�testAssertRaisesRegex&s"�z#Test_TestCase.testAssertRaisesRegexc	Cs|�|jd|jtt�d�dd��|�|jd|jtddd��|�|jd�� |jtddd��Wd�n1s:wYWd�n1sIwY|�td��)|jtdd	d
��Wd�n1shwYWd�dSWd�dS1s�wYdS)Nz"^Exception not raised by <lambda>$r�cSrrrrrrrr;6rz8Test_TestCase.testAssertNotRaisesRegex.<locals>.<lambda>cSrrrrrrrr;:rr(�expectrrxry)rzr>rsr�r�rurrrr�testAssertNotRaisesRegex2s.�������"�z&Test_TestCase.testAssertNotRaisesRegexcC�*Gdd�dt�}|�t|j|dd��dS)Nc@r�)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcNr�rrrr�MyExcFr�r�cSr,�NTrrrrrr;HrzATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)rsr=rurz)rr�rrr�!testAssertRaisesRegexInvalidRegexD�z/Test_TestCase.testAssertRaisesRegexInvalidRegexcCr�)Nc@r�)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnNr�rrrr�MyWarnLr�r�cSr,r�rrrrrr;Nrz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr=rur])rr�rrr� testAssertWarnsRegexInvalidRegexJr�z.Test_TestCase.testAssertWarnsRegexInvalidRegexcCsZGdd�dtj�}|d�tjd<z|�ttjd�Wtjd=tjd=dStjd=tjd=w)Nc@seZdZedd��ZdS)z:Test_TestCase.testAssertWarnsModifySysModules.<locals>.FoocSsdtjd<dS)Nr'�@bar@)rc�modulesrrrr�__warningregistry__SszNTest_TestCase.testAssertWarnsModifySysModules.<locals>.Foo.__warningregistry__N)rrr�propertyr�rrrrrRsrrz@foo@rar�)�types�
ModuleTypercr�r�UserWarningr�warnrIrrr�testAssertWarnsModifySysModulesPs�
z-Test_TestCase.testAssertWarnsModifySysModulesc	CsBdd�}|�|jd|jtd|�|�|jd|jtt�d�|�dS)NcSr>�NZ
Unexpected)rsrrrrrm_rAz9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)rzr>rsr�r�rvrrr�testAssertRaisesRegexMismatch^s�
�z+Test_TestCase.testAssertRaisesRegexMismatchcs~Gdd�dt���fdd�}d}|���}|�||�Wd�n1s&wY|j}|�|��|�|jd|�dS)Nc@r�)z=Test_TestCase.testAssertRaisesExcValue.<locals>.ExceptionMockNr�rrrrrhnr�rhcs�|��rr)rrlrrrmqrAz4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)rsr=rDr�r;r )rrm�v�ctxr%rrlr�testAssertRaisesExcValuems

�z&Test_TestCase.testAssertRaisesExcValuecCsL|�t��|��Wd�n1swY|�t��
|�t�Wd�n1s.wY|�t��|�dd�Wd�n1sIwY|�t��|�td�Wd�n1sdwY|�t��|�tdfd�Wd�n1s�wY|�t��|�ttfd�Wd�dS1s�wYdS�NrHr�)r=rurzrDr�rrrr�$testAssertRaisesRegexNoExceptionType|s$
�����"�z2Test_TestCase.testAssertRaisesRegexNoExceptionTypec	Cs�dd�}|�t|�|�t|�|�ttf|�|jttjdtd�|�|j��|�tdd��Wd�n1s;wY|�t��|�td�Wd�n1sVwYt���*t�	dt�|�|j��|�t|�Wd�n1s}wYWd�n1s�wYt���2t�	dt�|�t��|�t|�Wd�n1s�wYWd�dSWd�dS1s�wYdS)	NcS�t�dt�dSr��rr��RuntimeWarningrrrr�
_runtime_warn�r.z<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr��categorycSr,rrrrrrrr;�rz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultrZ)
rr�rrr�r=r>rurr�rr�rrr�testAssertWarnsCallable�s8���
���
��"�z%Test_TestCase.testAssertWarnsCallablec
Cszdd�}t�|�d}|�t��}|�Wd�n1swY|�ttf��}|�Wd�n1s8wY|�|jt�|�|jjdd�|�	d|j
�|�|j|d�|�t��|�|�Wd�n1stwY|�t��tj
dtd�Wd�n1s�wY|�|j��|�t��Wd�n1s�wYWd�n1s�wY|�|jd��|jtdd	��Wd�n1s�wYWd�n1s�wY|�td�� |jtd
d��Wd�n	1�swYWd�n	1�swYt���>t�dt�|�|j��!|�t��|�Wd�n	1�sCwYWd�n	1�sSwYWd�n	1�scwYt���Ft�d
t�|�t��!|�t��|�Wd�n	1�s�wYWd�n1�s�wYWd�dSWd�dS1�s�wYdS)NcSr�r�r�rrrrr��r.z;Test_TestCase.testAssertWarnsContext.<locals>._runtime_warnrHrr�test_case.pyr�r(rrxryr�rZ)�inspect�getsourcelinesrr�rr��warningr;r r�r�linenorr�r=r>rzrurr�rr�Z_runtime_warn_linenorFrrr�testAssertWarnsContext�st�������������
�����
�� ��$�z$Test_TestCase.testAssertWarnsContextcCsH|�t��|��Wd�n1swY|�t��
|�d�Wd�n1s.wY|�t��
|�t�Wd�n1sHwY|�t��|�tdf�Wd�n1sdwY|�t��|�ttf�Wd�n1s�wY|�t��|�ttf�Wd�dS1s�wYdSr|)r=rurr�r�rsrrrr�testAssertWarnsNoExceptionType�s$
�����"�z,Test_TestCase.testAssertWarnsNoExceptionTypec	Cs�dd�}|�td|d�|�|j��|�tddd��Wd�n1s&wY|�t��|�tdd�Wd�n1sBwYt���,t�dt�|�|j��|�td|d�Wd�n1skwYWd�n1szwY|�|j��|�td|d�Wd�n1s�wYt���7t�d	t�|�t|jf��|�td|d�Wd�n1s�wYWd�dSWd�dS1s�wYdS)
NcS�t�|t�dSrr�rrrrr��r.zATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warn�o+�fooxcSr,rrrrrrrr;�rz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>r��barzrZ)	r]r�r=r>rurrrrr�rrr�testAssertWarnsRegexCallable�sH����
������
���"�z*Test_TestCase.testAssertWarnsRegexCallablec
CsNdd�}t�|�d}|�td��}|d�Wd�n1s wY|�|jt�|�|jjdd�|�d|j	�|�|j
|d�|�|j��|�td��Wd�n1s^wYWd�n1smwY|�
|jd�� |jtddd	��Wd�n1s�wYWd�n1s�wY|�
td�� |jtdd
d��Wd�n1s�wYWd�n1s�wYt���?t�dt�|�|j��"|�td��|d�Wd�n1s�wYWd�n	1�swYWd�n	1�swY|�|j��#|�td��|d
�Wd�n	1�s8wYWd�n	1�sHwYt���Kt�dt�|�t|jf��#|�td��|d
�Wd�n	1�swwYWd�n1�s�wYWd�dSWd�dS1�s�wYdS)NcSr�rr�rrrrr�r.z@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnrHr�r�rr�r(rrxryr�r�rZ)r�r�r]r�r�r�r;r r�rr�r=r>rzrurrrrr�rrr�testAssertWarnsRegexContextsl
����������

�����
���

�� ��$�z)Test_TestCase.testAssertWarnsRegexContextcCs�|�t��|��Wd�n1swY|�t��
|�t�Wd�n1s.wY|�t��|�dd�Wd�n1sIwY|�t��|�td�Wd�n1sdwY|�t��|�tdfd�Wd�n1s�wY|�t��|�ttfd�Wd�n1s�wY|�t��|�ttfd�Wd�dS1s�wYdSr�)r=rur]r�r�rsrrrr�#testAssertWarnsRegexNoExceptionType2s*
������"�z1Test_TestCase.testAssertWarnsRegexNoExceptionTypeccsB�t��}dVWd�n1swY|�|��d�dS)Nr�)r	r;�getvalue)r�bufrrr�assertNoStderrBs
��zTest_TestCase.assertNoStderrcCs^|�t|�t|��t||�D]\}}|�|tj�|��D]
\}}|�t||�|�qqdSr)r;r�zipr��logging�	LogRecord�items�getattr)r�records�matchesZrec�match�kr�rrr�assertLogRecordsHs��zTest_TestCase.assertLogRecordsc	Cs�|���9|���}t�d�t�d�Wd�n1swY|�|jdg�|�|j	ddig�Wd�dS1s@wYdS)N�1rK�
INFO:foo:1�namer)
r��
assertLogs�log_foo�info�
log_foobarr�r;�outputr�r��rrFrrr�testAssertLogsDefaultsOs


�"�z$Test_TestCase.testAssertLogsDefaultsc	Cs�|���B|���}t�d�t�d�t�d�Wd�n1s#wY|�|j	ddg�|�
|jddiddig�Wd�dS1sIwYdS)	Nr�rK�3r��WARNING:quux:3r�rr
�r�r�r�r�r�r��log_quuxr�r;r�r�r�r�rrr�!testAssertLogsTwoMatchingMessagesXs



��"�z/Test_TestCase.testAssertLogsTwoMatchingMessagesc	Cs�|���D|j|d��}t�d�t�d�t�d�Wd�n1s%wY|�|j	ddg�|�
|jddidd	ig�Wd�dS1sKwYdS)
N��levelr�rKr�zERROR:foo.bar:2zCRITICAL:quux:3r�rr
)r�r�r�r�r�rZr��criticalr;r�r�r�)rr�rFrrr�checkAssertLogsPerLevelcs


��"�z%Test_TestCase.checkAssertLogsPerLevelcCs|�tj�|�d�dS)N�ERROR)r�r�r�rrrr�testAssertLogsPerLevelnsz$Test_TestCase.testAssertLogsPerLevelc
Cs�|���c|jdd��D}|j|dd��}t�d�t�d�t�d�Wd�n1s-wY|�|j	ddg�|�
|jdd	idd
ig�Wd�n1sRwY|�|j	dg�Wd�dS1sjwYdS)N�DEBUGr�r�rKr�r�zDEBUG:foo.bar:2r�rrr�r�)r�loggerZouter_cmrFrrr�checkAssertLogsPerLoggerrs


���	"�z&Test_TestCase.checkAssertLogsPerLoggercCs|�t�d��|�d�dSr�)r�r��	getLoggerrrrr�testAssertLogsPerLogger�sz%Test_TestCase.testAssertLogsPerLoggerc
Cs�|���;|�|j��|���Wd�n1swYWd�n1s*wYWd�dSWd�dS1sBwYdSr)r�r=r>r�rrrr�testAssertLogsFailureNoLogs�s

����"�z)Test_TestCase.testAssertLogsFailureNoLogsc
Cs�|���B|�|j��#|jdd��
t�d�Wd�n1s"wYWd�n1s1wYWd�dSWd�dS1sIwYdS�N�WARNINGr�r�)r�r=r>r�r�r�rrrr�!testAssertLogsFailureLevelTooHigh�s
����"�z/Test_TestCase.testAssertLogsFailureLevelTooHighc
Cs�|���Qtj}t�tj�z8|�|j��#|jdd��
t�	d�Wd�n1s,wYWd�n1s;wYWt�|�nt�|�wWd�dS1sXwYdSr�)
r�r�r��setLevelr��INFOr=r>r�r�)rZoldLevelrrr�4testAssertLogsFailureLevelTooHigh_FilterInRootLogger�s
����"�zBTest_TestCase.testAssertLogsFailureLevelTooHigh_FilterInRootLoggerc
Cs�|jddd��A|�|j��"|�d��
t�d�Wd�n1s$wYWd�n1s3wYWd�dSWd�dS1sKwYdS)Nr
r�r�rr�)r�r=r>r�rZrrrr�&testAssertLogsFailureMismatchingLogger�s����"�z4Test_TestCase.testAssertLogsFailureMismatchingLoggerc	C�R|�t��|���td��1swYWd�dS1s"wYdSr�)r=�ZeroDivisionErrorr�rrrr�!testAssertLogsUnexpectedException��

�"�z/Test_TestCase.testAssertLogsUnexpectedExceptionc	Cs~|�|j��&}|���t�d�t�d�Wd�n1s wYWd�n1s/wY|�t|j	�d�dS)Nr�rKz%Unexpected logs found: ['INFO:foo:1'])
r=r>�assertNoLogsr�r�r�r�r;r�rDr�rrr�testAssertNoLogsDefault�s

����z%Test_TestCase.testAssertNoLogsDefaultc	Cs~|�|j��&}|���t�d�t�d�Wd�n1s wYWd�n1s/wY|�t|j�d�dS)Nr�rz8Unexpected logs found: ['ERROR:quux:1', 'ERROR:foo:foo'])	r=r>r�r�rZr�r;r�rDr�rrr� testAssertNoLogsFailureFoundLogs�s

����z.Test_TestCase.testAssertNoLogsFailureFoundLogsc
Cs�|���A|�t��#|jtd��
t�d�Wd�n1s!wYWd�n1s0wYWd�dSWd�dS1sHwYdS)N�r�r�)r�r�r�r�r�rZrrrr�testAssertNoLogsPerLogger�s
����"�z'Test_TestCase.testAssertNoLogsPerLoggerc
Cs�|�|j��=}|�t��(|jtd��t�d�t�d�Wd�n1s(wYWd�n1s7wYWd�n1sFwY|�	t
|j�d�dS)Nr�r�rKz)Unexpected logs found: ['INFO:foo.bar:2'])r=r>r�r�r�r�rZr�r�r;r�rDr�rrr� testAssertNoLogsFailurePerLogger�s
������z.Test_TestCase.testAssertNoLogsFailurePerLoggerc	Cs~|���1|jdd��t�d�t�d�Wd�n1s wYWd�dSWd�dS1s8wYdS)Nr�r�rr�)r�r�r�r�r�r�rrrr�testAssertNoLogsPerLevel�s

��"�z&Test_TestCase.testAssertNoLogsPerLevelc	Cs�|�|j��(}|jdd��t�d�t�d�Wd�n1s"wYWd�n1s1wY|�t|j�d�dS)Nr�r�rr�z8Unexpected logs found: ['DEBUG:foo:foo', 'DEBUG:quux:1'])	r=r>r�r�r�r�r;r�rDr�rrr�testAssertNoLogsFailurePerLevel�s
����z-Test_TestCase.testAssertNoLogsFailurePerLevelc	Cr�r�)r=r�r�rrrr�#testAssertNoLogsUnexpectedException�r�z1Test_TestCase.testAssertNoLogsUnexpectedExceptioncCs6|���}Wd�n1swY|�|�dSr)r�r�)r�valuerrr�testAssertNoLogsYieldsNone�s
�z(Test_TestCase.testAssertNoLogsYieldsNonecCs�	|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��||�Wd�n1smwYqUdS)N)r9r�r9r9)�@r�)g@g@)TcSsddS)Ng��Q�	@Zspamr)�_rrrr;�z9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)FrHr:r�r9)r�r�r�rcSsidSr�rrrrrr;r�)r'r')�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesru�failIfrr�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrr)r�old�methr rrr�testDeprecatedMethodNames�s.�
���z'Test_TestCase.testDeprecatedMethodNamesc	Csb	tjdd�dkrdSgd�}|D]}|�t��
t||�Wd�n1s)wYqdS)Nr:r�)r�r�r�r�r�r�r�r)rc�version_infor=r?r�)rZdeprecated_namesZdeprecated_namerrr�_testDeprecatedFailMethodss���z(Test_TestCase._testDeprecatedFailMethodscCs&Gdd�dtj�}|d�}t|�dS)Nc@r)z0Test_TestCase.testDeepcopy.<locals>.TestableTestcSrrrrrrr�testNothingrKz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrrrrrr�TestableTestr!rr)r1r2r)rrr#rrr�testDeepcopyszTest_TestCase.testDeepcopycCsVt�d�}ttjd�D]}tj||d�}t�|�}|�||�|�t�t��qdS)Nr@rH)�protocol)	r1r2r�pickle�HIGHEST_PROTOCOL�dumps�loadsr;r
)rr#rZ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
���Wd�n1sUwYq=dS)NcS�t�r)�KeyboardInterruptrrrr�_raise6rKz3Test_TestCase.testKeyboardInterrupt.<locals>._raisecSrrrrrrr�nothing8rKz4Test_TestCase.testKeyboardInterrupt.<locals>.nothingc�eZdZ�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test1N�rrr�test_somethingr�rrr�Test1;�rc�eZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N�rrrr+rr�rrrr�Test2>�rc�eZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N�rrrrr/rrrr�Test3Brrcr�)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4c�|���dSr�rCrrrrrGr�zATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingNrrrrr�Test4Fr�r"rr)r1r2r=rr@)rrrrr"�klassrrr�testKeyboardInterrupt5s
���z#Test_TestCase.testKeyboardInterruptc�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}||||fD]}t��}|d
��|�|�t|j�d�|�|jd�q=dS)NcSs
t�d��)Nzsome reason)r1ZSkipTestrrrr�_skipOrfz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSrrrrrrrrQrKz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1Nrr�r&rrrTrrcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2Nrr�r&rrrrWrrcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3Nrrr(rrr[rrcr�)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cr rr!rr'rrr`r�zBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingNrrr'rrr"_r�r"rrHr)r1r2rOr@r;rZskipped�testsRun�rrrrr"r#rPrr(r�testSkippingEverywhereN�
�z$Test_TestCase.testSkippingEverywherecr%)NcSrr)�
SystemExitrrrrrjrKz,Test_TestCase.testSystemExit.<locals>._raisecSrrrrrrrrlrKz-Test_TestCase.testSystemExit.<locals>.nothingcr)z+Test_TestCase.testSystemExit.<locals>.Test1Nrrrrrrorrcr)z+Test_TestCase.testSystemExit.<locals>.Test2Nrrrrrrrrrcr)z+Test_TestCase.testSystemExit.<locals>.Test3Nrrrrrrvrrcr�)z+Test_TestCase.testSystemExit.<locals>.Test4cr rr!rrrrr{r�z:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingNrrrrrr"zr�r"rrHr)r1r2rOr@r;r�errorsr)r*rrr�testSystemExitir,zTest_TestCase.testSystemExitcCsNt��}t�|�}t���~|�|��Wd�dS1s wYdSr)r1r2�weakref�refrZ
disable_gcr�)rr�wrrrr�testNoCycles�s

"�zTest_TestCase.testNoCyclescs\G�fdd�dt��G�fdd�dtj�}dD]}||�}|��t�|��jd�qdS)Ncs(eZdZdZ�fdd�Z�fdd�ZdS)z9Test_TestCase.test_no_exception_leak.<locals>.MyExceptionrcs�jd7_t�|�dSr|)�	ninstancersr&rr5rrr&�rzzBTest_TestCase.test_no_exception_leak.<locals>.MyException.__init__cs�jd8_dSr|)r4rr5rr�__del__�r�zATest_TestCase.test_no_exception_leak.<locals>.MyException.__del__N)rrrr4r&r5rr5rrr6�sr6cs*eZdZ�fdd�Zej�fdd��ZdS)z6Test_TestCase.test_no_exception_leak.<locals>.TestCasec����rrrr5rrr�r�z<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test1cr6rrrr5rrr�sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test2N)rrrrr1ZexpectedFailurerrr5rrr2�sr2)rrr)rsr1r2r@r
r;r4)rr2Zmethod_nameZtestcaserr5r�test_no_exception_leak�s
�z$Test_TestCase.test_no_exception_leakN)|rrrrrZeq_pairsr Zne_pairsrArCrFrJrQrbrlrsrwr}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r1ZskipIfrcrd�optimizer�r�r�r�r�r�r�r�r�r
rrr&r+r0r2rGrIrTrVrWr[r\rerfrgrwr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r`�contextmanagerr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r$r+r/rZcpython_onlyr3r7rrrrr39s��

		


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



r3�__main__)#r`rrr	r�rcr�rr0r�r��copyrr#rr1Zunittest.test.supportrrrrrZtest.supportr	r
r�r�r�r�r�rr2r3r�mainrrrr�<module>sL


}�