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.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@sDeZdZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)	�Testz5Keep these TestCase classes out of the main namespacec@�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 cs8eZdZdZ�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&+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)	rrr�__doc__r&r+r#r/�
__classcell__rrr(rr%(sr%N)	rrrr0�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��)r2r3�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>.TestcSr5rr6rrrrrjr8z?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSrrrrrrrr#krz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testNr9rrrrrirrr#i����z
.Test.test)r2r3r<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>.TestcSr5rr6rrrrrur8zATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSrrrrrrrr#vrz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testNr9rrrrrtrrZtestfoozFailed to raise ValueError)r2r3�
ValueError�failrCrrr�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#�)r2r3r<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)r2r3�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+r1r�rr(rr��r)�	startTestr+�addError�stopTest�rrr%rAr<�rr'rQ�expectedrr[r�#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'rrrrrN��
z_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcrUrVrWrrYrrr+�rZzSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrrNr+r1rr[r(rr��r)�startTestRunr]r+r^r_�stopTestRun�rr%rAr<�rr'rbrr[r�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)NcrT)z=Test_TestCase.test_run_call_order__error_in_test.<locals>.FoocrU�N�raised by Foo.test�r$r#rXrrYrrr#�rZzBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test�rrrr#r1rr[r(rr�r\r�r]r+r#r/r^r_r`rarr[r�"test_run_call_order__error_in_test��z0Test_TestCase.test_run_call_order__error_in_testcs>g}G�fdd�dtj��gd�}�|���|�||�dS)Ncrd)zLTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.FoocSrerrfrrrrrN�rgz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcrUrorqrrYrrr#�rZzQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test�rrrrNr#r1rr[r(rr�rhr�rir]r+r#r/r^r_rjrkrlrr[r�1test_run_call_order__error_in_test_default_result�s
z?Test_TestCase.test_run_call_order__error_in_test_default_resultcrn)NcrT)z?Test_TestCase.test_run_call_order__failure_in_test.<locals>.Fooc�t�|���|�d�dSro�r$r#rFrrYrrr#��zDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.testrrrr[r(rr�r\r�r]r+r#r/�
addFailurer_r`rarr[r�$test_run_call_order__failure_in_test�ruz2Test_TestCase.test_run_call_order__failure_in_testcs>G�fdd�dtj��gd�}g}�|���|�||�dS)Ncrd)zNTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.FoocSrerrfrrrrrN�rgz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcryrorzrrYrrr#�r{zSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.testrvrr[r(rr��r)rir]r+r#r/r}r_rjrk)rrbr'rr[r�3test_run_call_order__failure_in_test_default_result�s
zATest_TestCase.test_run_call_order__failure_in_test_default_resultcrS)NcrT)zATest_TestCase.test_run_call_order__error_in_tearDown.<locals>.FoocrU�Nzraised by Foo.tearDown�r$r/rXrrYrrr/rZzJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr/r1rr[r(rrr\rrsr`rarr[r�&test_run_call_order__error_in_tearDownsz4Test_TestCase.test_run_call_order__error_in_tearDowncs>G�fdd�dtj��g}�|���gd�}|�||�dS)Ncrd)zPTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.FoocSrerrfrrrrrNrgzbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcrUr�r�rrYrrr/rZzYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrrNr/r1rr[r(rrrrrwrkrlrr[r�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)rrrrrrN.�zOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSrrrrrrrr#0rLzBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrrNr#rrrrr-srr#)r2r3rArJrrr�"test_run_call_order_default_result+sz0Test_TestCase.test_run_call_order_default_resultc�4G�fdd�dtj���|��|�|�||�dS)NcrT)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�rIr;r:��irI�failure�r;r:��j�rpr)r$r#�subTestrFrX�rr�r�rYrrr#7s 
������z;Test_TestCase._check_call_order__subtests.<locals>.Foo.testrrrr[r(rr6r\rrk�rrQr'Zexpected_eventsrr[r�_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�rarrr�test_run_call_order__subtestsMsz+Test_TestCase.test_run_call_order__subtestscCr�)Nr|)rr�rarrr�$test_run_call_order__subtests_legacyVsz2Test_TestCase.test_run_call_order__subtests_legacycr�)NcrT)z>Test_TestCase._check_call_order__subtests_success.<locals>.Foocs~t�|���dD]3}|j|d��#dD]}|j|d��Wd�n1s'wYqWd�n1s7wYq	dS)N)rIr;r�r�r�)r$r#r�r�rYrrr#as������zCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.testrrrr[r(rr`r\rrkr�rr[r�#_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�rarrr�%test_run_call_order__subtests_successls��z3Test_TestCase.test_run_call_order__subtests_successcCr�)N)r]r+r#r/r�r_)rr�rarrr�,test_run_call_order__subtests_success_legacyvsz:Test_TestCase.test_run_call_order__subtests_success_legacycsNg}t|�}d|_G�fdd�dtj��gd�}�|��|�|�||�dS)NTcrT)zATest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foocs�t�|���|jdd��
|�d�Wd�n1swY|jdd��
|�d�Wd�n1s8wY|�d�dS)NrIr�r�r;)r$r#r�rFrrYrrr#�s��zFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.testrrrr[r(rr�r\r)r]r+r#r/r�r_)r�failfastrr%rAr<rarr[r�&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-rFrr�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�)r2r3rPr�Z	makeSuiterAr<)rrrQZsuiterbrr�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�)r2r3�debugr<rJrr�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#�rLz>Test_TestCase.test_failureException__default.<locals>.Foo.testNrHrrrrr�r!rr#)r2r3�assertIsr?�AssertionErrorrJrrr�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>.FoocSr5r)rXrrrrr#�r�zRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN�rrrr#rXr?rrrrr��rr#�r]r}r_�rr2r3r�r?rXrAr<�rr'rQrrbrrr�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)rFrrrrr#�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�rLz-Test_TestCase.test_setUp.<locals>.Foo.runTestNrMrrrrr�r!r)r2r3r+rJrrr�
test_setUp��zTest_TestCase.test_setUpcCr�)Nc@r)z(Test_TestCase.test_tearDown.<locals>.FoocSrrrrrrrrrLz0Test_TestCase.test_tearDown.<locals>.Foo.runTestNrMrrrrrr!r)r2r3r/rJrrr�
test_tearDown�r�zTest_TestCase.test_tearDowncCs(Gdd�dtj�}|�|���t�dS)Nc@r)z"Test_TestCase.test_id.<locals>.FoocSrrrrrrrrrLz*Test_TestCase.test_id.<locals>.Foo.runTestNrMrrrrrr!r)r2r3�assertIsInstancer=�strrJrrr�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)�
defaultResultrrrN!rLzMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrr#rNr�r�r'rrrsrr#)rir]r#r�r_rj)rr2r3rAr�r<)rrrQrbrr�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#1rLz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testNrHrrrrr0r!rr#)r2r3rPrAr�)rrrQ�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#ArLzPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|�|���Sr)r�)rrQ�ZresultInZ	resultOutrrrADszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrr#rArr�rrr@srr#)r2rPr3r�)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 abovecCs|�|��d�dS)z7Tests shortDescription() for a method with a docstring.N�r<r�rrrr�(testShortDescriptionWithOneLineDocstringPs�z6Test_TestCase.testShortDescriptionWithOneLineDocstringcC�|�|��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.testShortDescriptionWithMultiLineDocstringcCr�)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)rrrr0rrrr�SadSnaker�r�cs t|�t|�ko
�kSSr)rO)�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�rIr�)�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�rIr;�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�rIr;�r:)�set�	frozensetr<r?rFr>)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�rIr�zThese are unequal)�assertListEqual�assertTupleEqual�assertSequenceEqualr>r2r3r?�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��
rIr;rz!assertSequenceEqual did not fail.)r<�maxDiffr�difflibZndiff�pprintZpformat�
splitlinesr2�case�DIFF_OMITTED�lenrr?�argsrF�
assertLessr��
assertGreaterr�)rZseq1Zseq2�diff�omitted�er�rrr�testAssertSequenceEqualMaxDiff$sJ���
��
��
z,Test_TestCase.testAssertSequenceEqualMaxDiffcCsrd|_|�dd�}tjjtd�}|�|d|�d|_|�dd�}|�|d�d|_|�dd�}|�|d�dS)NrIr�bar�foobarr�)r�_truncateMessager2rrrr<)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\rLz<Test_TestCase.testAssertDictEqualTruncates.<locals>.truncaterIrrzassertDictEqual did not fail)r2r3r(rr?r<r�rF�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-hrLzATest_TestCase.testAssertMultiLineEqualTruncates.<locals>.truncaterr&z!assertMultiLineEqual did not fail)r2r3r(�assertMultiLineEqualr?r<r�rFr.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>.explodingTruncationcr3)Nr(r6r)�old_truncaterrrr:�r;z%r != %r)r<r5r�
addCleanupr>r?r�r��	exceptionr(r�)r�s�cmr?r�r�r)r9rArr�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)Nrcr3r4r6rr8rrr:�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)r5rBr>r?r<r�rC)rrDr�r�rEr��pr�rr8r�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�)r:r;rI)rr&�baz)r&rIrr;r:)rI�2r�r�)r�rJTr�rI�d)r�rJTrI�
�)rLrMrLr�rFr�y@y@r�r�)rIrIr;)rIrIrJr�r�)rJrJTr�T���ZaaabccdZabbbcce>)r:rIr�)rIr:r�)rrIr$)rIrr�)
r��assertCountEqualr>r?�iter�divmodr
rr2�utilZ_count_diff_all_purposer<Z_count_diff_hashable)rr�r�Zdiffsrbrrr�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)rrIr�)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;rIg�������?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.
rrI)rr0r?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
? ++                   ^^^^^
rrI)r<r?r�rWrXrrr�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^�r@r��ar)rarara)�sys�flagsr^r>r?r<ZassertNotEqualrrrrrTrrrO)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@�eZdZdS)z=Test_TestCase.testAssertRaisesCallable.<locals>.ExceptionMockN�rrrrrrr�
ExceptionMock��ric��d���N�	We expectrr�rirr�Stub�r@z4Test_TestCase.testAssertRaisesCallable.<locals>.Stub�19���basecSr+�Nrrrrrrr:�rz8Test_TestCase.testAssertRaisesCallable.<locals>.<lambda>)�	Exceptionr>rE�intr?�	TypeError�rrorrnr�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@rg)z<Test_TestCase.testAssertRaisesContext.<locals>.ExceptionMockNrhrrrrri�rjricrkrlrrrnrrro�r@z3Test_TestCase.testAssertRaisesContext.<locals>.Stubrrmrprqrrr'r
�*�r')rur>rEr�rCr<rrvr?�assertRaisesRegexrw)rrorErrnr�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�NrI)r>rwr�rErrrr�testAssertRaisesNoExceptionType
s
����"�z-Test_TestCase.testAssertRaisesNoExceptionTypecCs4dd�}t�|�}|�t|�|�|t�|��dS)NcSszt�tyt�wr)rErrrr�funcs
�z4Test_TestCase.testAssertRaisesRefcount.<locals>.func)rb�getrefcountr>rEr<)rr�Zrefcountrrr�testAssertRaisesRefcounts
z&Test_TestCase.testAssertRaisesRefcountcs|Gdd�dt���fdd�}|��t�d�|�|��d|�|�t��|��dd�Wd�dS1s7wYdS)Nc@rg)z:Test_TestCase.testAssertRaisesRegex.<locals>.ExceptionMockNrhrrrrri'rjricrkrlrrrnrrro*r@z1Test_TestCase.testAssertRaisesRegex.<locals>.Stubzexpect$)rur|�re�compiler>rwrxrrnr�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'�expectr
rzr{)r|r?rur�r�rwrrrr�testAssertNotRaisesRegex2s.�������"�z&Test_TestCase.testAssertNotRaisesRegexcC�*Gdd�dt�}|�t|j|dd��dS)Nc@rg)z>Test_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.MyExcNrhrrrr�MyExcFrjr�cSr+�NTrrrrrr:HrzATest_TestCase.testAssertRaisesRegexInvalidRegex.<locals>.<lambda>)rur>rwr|)rr�rrr�!testAssertRaisesRegexInvalidRegexD�z/Test_TestCase.testAssertRaisesRegexInvalidRegexcCr�)Nc@rg)z>Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.MyWarnNrhrrrr�MyWarnLrjr�cSr+r�rrrrrr:Nrz@Test_TestCase.testAssertWarnsRegexInvalidRegex.<locals>.<lambda>)�Warningr>rwr\)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@)rb�modulesrrrr�__warningregistry__SszNTest_TestCase.testAssertWarnsModifySysModules.<locals>.Foo.__warningregistry__N)rrr�propertyr�rrrrrRsrrz@foo@rbr�)�types�
ModuleTyperbr�r�UserWarningr��warnrJrrr�testAssertWarnsModifySysModulesPs�
z-Test_TestCase.testAssertWarnsModifySysModulesc	CsBdd�}|�|jd|jtd|�|�|jd|jtt�d�|�dS)NcSr=�NZ
Unexpected)rurrrrro_r@z9Test_TestCase.testAssertRaisesRegexMismatch.<locals>.Stubz*"\^Expected\$" does not match "Unexpected"z
^Expected$)r|r?rur�r�rxrrr�testAssertRaisesRegexMismatch^s�
�z+Test_TestCase.testAssertRaisesRegexMismatchcs~Gdd�dt���fdd�}d}|���}|�||�Wd�n1s&wY|j}|�|��|�|jd|�dS)Nc@rg)z=Test_TestCase.testAssertRaisesExcValue.<locals>.ExceptionMockNrhrrrrrinrjrics�|��rr)rrnrrroqr@z4Test_TestCase.testAssertRaisesExcValue.<locals>.Stubzparticular valuer)rur>rCr�r<r)rro�v�ctxr$rrnr�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�NrIr�)r>rwr|rEr�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��r�r��RuntimeWarningrrrr�
_runtime_warn�r.z<Test_TestCase.testAssertWarnsCallable.<locals>._runtime_warnr��categorycSr+rtrrrrrr:�rz7Test_TestCase.testAssertWarnsCallable.<locals>.<lambda>�defaultrY)
rr�rr�r�r>r?rwrr�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_warnrIrr�test_case.pyr�r'r
rzr{r�rY)�inspect�getsourcelinesrr�rr��warningr<rr�r�linenor�r�r>r?r|rwrr�rr�Z_runtime_warn_linenorErrr�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>rwrr�r�rurrrr�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�r
rrrr��r.zATest_TestCase.testAssertWarnsRegexCallable.<locals>._runtime_warn�o+�fooxcSr+rtrrrrrr:�rz<Test_TestCase.testAssertWarnsRegexCallable.<locals>.<lambda>r��barzrY)	r\r�r>r?rwr�rrrr�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�r
rrrr�r.z@Test_TestCase.testAssertWarnsRegexContext.<locals>._runtime_warnrIr�r�rr�r'r
rzr{r�r�rY)r�r�r\r�r�r�r<rr�rr�r>r?r|rwr�rrrr�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>rwr\r�r�rurrrr�#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�1rJ�
INFO:foo:1�namer)
r��
assertLogs�log_foo�info�
log_foobarr�r<�outputr�r��rrErrr�testAssertLogsDefaultsOs


�"�z$Test_TestCase.testAssertLogsDefaultsc	Cs�|���B|���}t�d�t�d�t�d�Wd�n1s#wY|�|j	ddg�|�
|jddiddig�Wd�dS1sIwYdS)	Nr�rJ�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�rJr�zERROR:foo.bar:2zCRITICAL:quux:3r�rr
)r�r�r�r�r�rYr��criticalr<r�r�r�)rr�rErrr�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�rJr�r�zDEBUG:foo.bar:2r�rrr�r�)r�loggerZouter_cmrErrr�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�rYrrrr�&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�rJz%Unexpected logs found: ['INFO:foo:1'])
r>r?�assertNoLogsr�r�r�r�r<r�rCr�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�rYr�r<r�rCr�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�rYrrrr�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�rJz)Unexpected logs found: ['INFO:foo.bar:2'])r>r?r�r�r�r�rYr�r�r<r�rCr�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�rCr�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�n1slwYqTdS)zY
        Test that the deprecated methods raise a DeprecationWarning. See #9424.
        )r:r�r:r:)�@r�)g@g@)TcSsddS)Ng��Q�	@Zspamr)�_rrrr:�z9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)FrIr;r�r:)r�r�r�rcSsidSr�rrrrrr:r�)r&r&N)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesrw�failIfrr�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrr)r�old�methrrrr�testDeprecatedMethodNames�s,�
���z'Test_TestCase.testDeprecatedMethodNamesc	Cs`tjdd�dkrdSgd�}|D]}|�t��
t||�Wd�n1s(wYqdS)z9Test that the deprecated fail* methods get removed in 3.xNr;r�)r�r�r�r�r�r�rr)rb�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�testNothingrLz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrrrrrr�TestableTestr!rr)r2r3r)rrr#rrr�testDeepcopyszTest_TestCase.testDeepcopycCsVt�d�}ttjd�D]}tj||d�}t�|�}|�||�|�t�t��qdS)NrArI)�protocol)	r2r3r�pickle�HIGHEST_PROTOCOL�dumps�loadsr<r)rr#r
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
���Wd�n1sUwYq=dS)NcS�t�r)�KeyboardInterruptrrrr�_raise6rLz3Test_TestCase.testKeyboardInterrupt.<locals>._raisecSrrrrrrr�nothing8rLz4Test_TestCase.testKeyboardInterrupt.<locals>.nothingc�eZdZ�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test1N�rrr�test_somethingr�rrr�Test1;r�rc�eZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N�rrrr+rr�rrrr�Test2>�rc�eZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N�rrrrr/rrrr�Test3Brr cr�)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4c�|���dSr�rBrrrrrGr�zATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingNrrrrr�Test4Fr�r#rr)r2r3r>rrA)rrrr r#�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)r2ZSkipTestrrrr�_skipOrgz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSrrrrrrrrQrLz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1Nrr�r'rrrTr�rcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2Nrr�r'rrrrWrrcr)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3Nrrr)rrr [rr cr�)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cr!rr"rr(rrr`r�zBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingNrrr(rrr#_r�r#rrIr)r2r3rPrAr<rZskipped�testsRun�rrrr r#r$rQrr)r�testSkippingEverywhereN�
�z$Test_TestCase.testSkippingEverywherecr&)NcSrr)�
SystemExitrrrrrjrLz,Test_TestCase.testSystemExit.<locals>._raisecSrrrrrrrrlrLz-Test_TestCase.testSystemExit.<locals>.nothingcr)z+Test_TestCase.testSystemExit.<locals>.Test1Nrrrrrror�rcr)z+Test_TestCase.testSystemExit.<locals>.Test2Nrrrrrrrrrcr)z+Test_TestCase.testSystemExit.<locals>.Test3Nrrrrrr vrr cr�)z+Test_TestCase.testSystemExit.<locals>.Test4cr!rr"rrrrr{r�z:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingNrrrrrr#zr�r#rrIr)r2r3rPrAr<r�errorsr*r+rrr�testSystemExitir-zTest_TestCase.testSystemExitcCsNt��}t�|�}t���~|�|��Wd�dS1s wYdSr)r2r3�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~)�	ninstancerur&rr6rrr&�r{zBTest_TestCase.test_no_exception_leak.<locals>.MyException.__init__cs�jd8_dSr~)r5rr6rr�__del__�r�zATest_TestCase.test_no_exception_leak.<locals>.MyException.__del__N)rrrr5r&r6rr6rrr7�sr7cs*eZdZ�fdd�Zej�fdd��ZdS)z6Test_TestCase.test_no_exception_leak.<locals>.TestCasec����rrrr6rrr�r�z<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test1cr7rrrr6rrr�sz<Test_TestCase.test_no_exception_leak.<locals>.TestCase.test2N)rrrrr2ZexpectedFailurerrr6rrr3�sr3)rrr)rur2r3rAr
r<r5)rr3Zmethod_nameZtestcaserr6r�test_no_exception_leak�s
�z$Test_TestCase.test_no_exception_leakN)|rrrrrZeq_pairsr Zne_pairsrBrDrGrKrRrcrmrtrxr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r2ZskipIfrbrc�optimizer�r�r�r�r�r�r�r�r�r	rrr%r*r/r1rFrHrSrUrVrZr[rdrerfryr}rr�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�rrr	rr%r,r0rZcpython_onlyr4r8rrrrr49s��

		


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



r4�__main__)#r_rrrr�rbr�r�r1r�r��copyrr#rr2Zunittest.test.supportrrrrrZtest.supportr	r
r�r�r�r�r�rr3r4r�mainrrrr�<module>sL


}�