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

"��g} �@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlZddlmZmZmZmZmZddlmZe�d�Ze�d�Ze�d�ZGd	d
�d
e�ZGdd�dejee�Ze d
kr�e�!�dS)�N)�deepcopy)�support)�TestEquality�TestHashing�
LoggingResult�LegacyLoggingResult�#ResultWithNoStartTestRunStopTestRun)�captured_stderr�foozfoo.bar�quuxc@s@eZdZGdd�dej�ZGdd�de�ZGdd�dej�ZdS)�Testc@seZdZdd�Zdd�ZdS)zTest.FoocCsdS)N�)�selfr
r
�3/usr/local/lib/python3.7/unittest/test/test_case.py�runTest"�zTest.Foo.runTestcCsdS)Nr
)rr
r
r�test1#rzTest.Foo.test1N)�__name__�
__module__�__qualname__rrr
r
r
r�Foo!src@seZdZdd�ZdS)zTest.BarcCsdS)Nr
)rr
r
r�test2&rzTest.Bar.test2N)rrrrr
r
r
r�Bar%srcs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	zTest.LoggingTestCasecsttj|��d�||_dS)N�test)�superr�LoggingTestCase�__init__�events)rr)�	__class__r
rr+szTest.LoggingTestCase.__init__cCs|j�d�dS)N�setUp)r�append)rr
r
rr/szTest.LoggingTestCase.setUpcCs|j�d�dS)Nr)rr )rr
r
rr2szTest.LoggingTestCase.testcCs|j�d�dS)N�tearDown)rr )rr
r
rr!5szTest.LoggingTestCase.tearDown)rrrrrrr!�
__classcell__r
r
)rrr(srN)rrr�unittest�TestCaserrrr
r
r
rrsrc@s�eZdZe�d�e�d�fgZe�d�e�d�fe�d�e�d�fe�d�e�d�fgZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'dDdE�Z(e)�*e+j,j-dFkdG�dHdI��Z.e)�*e+j,j-dFkdG�dJdK��Z/dLdM�Z0dNdO�Z1dPdQ�Z2dRdS�Z3dTdU�Z4dVdW�Z5dXdY�Z6dZd[�Z7d\d]�Z8d^d_�Z9d`da�Z:dbdc�Z;ddde�Z<dfdg�Z=dhdi�Z>djdk�Z?dldm�Z@dndo�ZAdpdq�ZBdrds�ZCdtdu�ZDdvdw�ZEdxdy�ZFdzd{�ZGd|d}�ZHd~d�ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYeZj[d�d���Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d��Zld�dÄZmenjod�dń�Zpd�dDŽZqd�S)��
Test_TestCaserrrc	Cs�Gdd�dtj�}|�|���dd�d�t��}|�dd�|�|j��|�dd�WdQRX|�t��|��WdQRXdS)Nc@seZdZdd�Zdd�ZdS)z3Test_TestCase.test_init__no_test_name.<locals>.TestcSs
t��dS)N)�MyException)rr
r
rrUrz;Test_TestCase.test_init__no_test_name.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrVrz8Test_TestCase.test_init__no_test_name.<locals>.Test.testN)rrrrrr
r
r
rrTsri�z
.Test.runTest��)r#r$�assertEqual�id�assertRaises�failureException�AttributeError�run)rrrr
r
r�test_init__no_test_nameSsz%Test_TestCase.test_init__no_test_namecCs2Gdd�dtj�}|�|d���dd�d�dS)Nc@seZdZdd�Zdd�ZdS)z7Test_TestCase.test_init__test_name__valid.<locals>.TestcSs
t��dS)N)r&)rr
r
rrjrz?Test_TestCase.test_init__test_name__valid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrkrz<Test_TestCase.test_init__test_name__valid.<locals>.Test.testN)rrrrrr
r
r
rrisrri����z
.Test.test)r#r$r)r*)rrr
r
r�test_init__test_name__validhsz)Test_TestCase.test_init__test_name__validcCsBGdd�dtj�}y|d�Wntk
r2YnX|�d�dS)Nc@seZdZdd�Zdd�ZdS)z9Test_TestCase.test_init__test_name__invalid.<locals>.TestcSs
t��dS)N)r&)rr
r
rrurzATest_TestCase.test_init__test_name__invalid.<locals>.Test.runTestcSsdS)Nr
)rr
r
rrvrz>Test_TestCase.test_init__test_name__invalid.<locals>.Test.testN)rrrrrr
r
r
rrtsrZtestfoozFailed to raise ValueError)r#r$�
ValueError�fail)rrr
r
r�test_init__test_name__invalidssz+Test_TestCase.test_init__test_name__invalidcCs*Gdd�dtj�}|�|d���d�dS)Nc@seZdZdd�ZdS)z.Test_TestCase.test_countTestCases.<locals>.FoocSsdS)Nr
)rr
r
rr�rz3Test_TestCase.test_countTestCases.<locals>.Foo.testN)rrrrr
r
r
rr�srr�)r#r$r)ZcountTestCases)rrr
r
r�test_countTestCases�sz!Test_TestCase.test_countTestCasescCs2Gdd�dtj�}|���}|�t|�tj�dS)Nc@seZdZdd�ZdS)z1Test_TestCase.test_defaultTestResult.<locals>.FoocSsdS)Nr
)rr
r
rr�sz9Test_TestCase.test_defaultTestResult.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r#r$�defaultTestResultr)�type�
TestResult)rr�resultr
r
r�test_defaultTestResult�s
z$Test_TestCase.test_defaultTestResultcsLg}t|�}G�fdd�dtj���|��|�ddddg}|�||�dS)NcseZdZ��fdd�Z�ZS)z>Test_TestCase.test_run_call_order__error_in_setUp.<locals>.Foocst�|���td��dS)Nzraised by Foo.setUp)rr�RuntimeError)r)rrr
rr�szDTest_TestCase.test_run_call_order__error_in_setUp.<locals>.Foo.setUp)rrrrr"r
)r)rrr�sr�	startTestr�addError�stopTest)rrrr.r))rrr9�expectedr
)rr�#test_run_call_order__error_in_setUp�sz1Test_TestCase.test_run_call_order__error_in_setUpcsFg}G�fdd�dtj���|���ddddddg}|�||�dS)	Ncs&eZdZdd�Z��fdd�Z�ZS)zMTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr6�sz_Test_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.defaultTestResultcst�|���td��dS)Nzraised by Foo.setUp)rrr;)r)rrr
rr�szSTest_TestCase.test_run_call_order__error_in_setUp_default_result.<locals>.Foo.setUp)rrrr6rr"r
)r)rrr�sr�startTestRunr<rr=r>�stopTestRun)rrr.r))rrr?r
)rr�2test_run_call_order__error_in_setUp_default_result�sz@Test_TestCase.test_run_call_order__error_in_setUp_default_resultcsPg}t|�}G�fdd�dtj��ddddddg}�|��|�|�||�dS)	NcseZdZ��fdd�Z�ZS)z=Test_TestCase.test_run_call_order__error_in_test.<locals>.Foocst�|���td��dS)Nzraised by Foo.test)rrr;)r)rrr
rr�szBTest_TestCase.test_run_call_order__error_in_test.<locals>.Foo.test)rrrrr"r
)r)rrr�srr<rrr!r=r>)rrrr.r))rrr9r?r
)rr�"test_run_call_order__error_in_test�sz0Test_TestCase.test_run_call_order__error_in_testcsJg}G�fdd�dtj��ddddddd	d
g}�|���|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)zLTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr6�sz^Test_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���td��dS)Nzraised by Foo.test)rrr;)r)rrr
rr�szQTest_TestCase.test_run_call_order__error_in_test_default_result.<locals>.Foo.test)rrrr6rr"r
)r)rrr�srrAr<rrr!r=r>rB)rrr.r))rrr?r
)rr�1test_run_call_order__error_in_test_default_result�sz?Test_TestCase.test_run_call_order__error_in_test_default_resultcsPg}t|�}G�fdd�dtj��ddddddg}�|��|�|�||�dS)	NcseZdZ��fdd�Z�ZS)z?Test_TestCase.test_run_call_order__failure_in_test.<locals>.Foocst�|���|�d�dS)Nzraised by Foo.test)rrr2)r)rrr
rr�szDTest_TestCase.test_run_call_order__failure_in_test.<locals>.Foo.test)rrrrr"r
)r)rrr�srr<rrr!�
addFailurer>)rrrr.r))rrr9r?r
)rr�$test_run_call_order__failure_in_test�sz2Test_TestCase.test_run_call_order__failure_in_testcsJG�fdd�dtj��ddddddd	d
g}g}�|���|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)zNTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr6�sz`Test_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.defaultTestResultcst�|���|�d�dS)Nzraised by Foo.test)rrr2)r)rrr
rr�szSTest_TestCase.test_run_call_order__failure_in_test_default_result.<locals>.Foo.test)rrrr6rr"r
)r)rrr�srrAr<rrr!rFr>rB)rrr.r))rr?rr
)rr�3test_run_call_order__failure_in_test_default_result�szATest_TestCase.test_run_call_order__failure_in_test_default_resultcsPg}t|�}G�fdd�dtj���|��|�ddddddg}|�||�dS)	NcseZdZ��fdd�Z�ZS)zATest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foocst�|���td��dS)Nzraised by Foo.tearDown)rr!r;)r)rrr
rr!szJTest_TestCase.test_run_call_order__error_in_tearDown.<locals>.Foo.tearDown)rrrr!r"r
)r)rrrsrr<rrr!r=r>)rrrr.r))rrr9r?r
)rr�&test_run_call_order__error_in_tearDowns
z4Test_TestCase.test_run_call_order__error_in_tearDowncsJG�fdd�dtj��g}�|���ddddddd	d
g}|�||�dS)Ncs&eZdZdd�Z��fdd�Z�ZS)zPTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.FoocSs
t|j�S)N)rr)rr
r
rr6szbTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.defaultTestResultcst�|���td��dS)Nzraised by Foo.tearDown)rr!r;)r)rrr
rr!szYTest_TestCase.test_run_call_order__error_in_tearDown_default_result.<locals>.Foo.tearDown)rrrr6r!r"r
)r)rrrsrrAr<rrr!r=r>rB)rrr.r))rrr?r
)rr�5test_run_call_order__error_in_tearDown_default_results

zCTest_TestCase.test_run_call_order__error_in_tearDown_default_resultcCs"Gdd�dtj�}|d���dS)Nc@seZdZdd�Zdd�ZdS)z=Test_TestCase.test_run_call_order_default_result.<locals>.FoocSst�S)N)r)rr
r
rr6.szOTest_TestCase.test_run_call_order_default_result.<locals>.Foo.defaultTestResultcSsdS)Nr
)rr
r
rr0szBTest_TestCase.test_run_call_order_default_result.<locals>.Foo.testN)rrrr6rr
r
r
rr-srr)r#r$r.)rrr
r
r�"test_run_call_order_default_result+sz0Test_TestCase.test_run_call_order_default_resultcs4G�fdd�dtj���|��|�|�||�dS)NcseZdZ��fdd�Z�ZS)z6Test_TestCase._check_call_order__subtests.<locals>.Foocs�t�|���xpdD]h}|j|d��R|dkr8|�d�x8dD]0}|j|d��||dkrdtd��WdQRXq>WWdQRXqWdd	dS)
N)r4r(r')�ir4�failure)r(r')�j�zraised by Foo.testr)rr�subTestr2r;)rrLrN)rrr
rr7s


$z;Test_TestCase._check_call_order__subtests.<locals>.Foo.test)rrrrr"r
)r)rrr6sr)rrr.r))rr9r�expected_eventsr
)rr�_check_call_order__subtests5sz)Test_TestCase._check_call_order__subtestscCs8g}t|�}dddddddddddg}|�|||�dS)	Nr<rrr!�addSubTestFailure�addSubTestSuccessr=r>)rrR)rrr9r?r
r
r�test_run_call_order__subtestsMs
z+Test_TestCase.test_run_call_order__subtestscCs.g}t|�}ddddddg}|�|||�dS)Nr<rrr!rFr>)rrR)rrr9r?r
r
r�$test_run_call_order__subtests_legacyVs
z2Test_TestCase.test_run_call_order__subtests_legacycs4G�fdd�dtj���|��|�|�||�dS)NcseZdZ��fdd�Z�ZS)z>Test_TestCase._check_call_order__subtests_success.<locals>.Foocs^t�|���xJdD]B}|j|d��,x$dD]}|j|d��WdQRXq,WWdQRXqWdS)N)r4r()rL)r(r')rN)rrrP)rrLrN)rrr
rras

zCTest_TestCase._check_call_order__subtests_success.<locals>.Foo.test)rrrrr"r
)r)rrr`sr)rrr.r))rr9rrQr
)rr�#_check_call_order__subtests_success_s	z1Test_TestCase._check_call_order__subtests_successcCs<g}t|�}ddddgddgddg}|�|||�dS)	Nr<rrr!rOrT�
addSuccessr>)rrW)rrr9r?r
r
r�%test_run_call_order__subtests_successlsz3Test_TestCase.test_run_call_order__subtests_successcCs.g}t|�}ddddddg}|�|||�dS)Nr<rrr!rXr>)rrW)rrr9r?r
r
r�,test_run_call_order__subtests_success_legacyvs
z:Test_TestCase.test_run_call_order__subtests_success_legacycsVg}t|�}d|_G�fdd�dtj��dddddd	g}�|��|�|�||�dS)
NTcseZdZ��fdd�Z�ZS)zATest_TestCase.test_run_call_order__subtests_failfast.<locals>.Fooc	s`t�|���|jdd��|�d�WdQRX|jdd��|�d�WdQRX|�d�dS)Nr4)rLrMr()rrrPr2)r)rrr
rr�szFTest_TestCase.test_run_call_order__subtests_failfast.<locals>.Foo.test)rrrrr"r
)r)rrr�srr<rrr!rSr>)r�failfastrrr.r))rrr9r?r
)rr�&test_run_call_order__subtests_failfast~s	z4Test_TestCase.test_run_call_order__subtests_failfastcsVg�G�fdd�dtj�}t��}d|_t�|�}|�|�dddg}|��|�dS)Ncs0eZdZ�fdd�Z�fdd�Z�fdd�ZdS)z1Test_TestCase.test_subtests_failfast.<locals>.Fooc	s,|�����d�WdQRX��d�dS)N�a1�a2)rPr )r)rr
r�test_a�s
z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_ac	sJ|�����d�WdQRX|���|�d�WdQRX��d�dS)N�b1rMZb2)rPr r2)r)rr
r�test_b�s


z8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_bcs��d�dS)N�c)r )r)rr
r�test_c�sz8Test_TestCase.test_subtests_failfast.<locals>.Foo.test_cN)rrrr_rarcr
)rr
rr�srTr]r^r`)r#r$r8r[Z	makeSuiter.r))rrr9Zsuiter?r
)rr�test_subtests_failfast�s


z$Test_TestCase.test_subtests_failfastcs:g�G�fdd�dtj�}|d���|��ddg�dS)NcseZdZ�fdd�ZdS)z.Test_TestCase.test_subtests_debug.<locals>.Fooc	s,��d�|�����d�WdQRXdS)Nz	test casez	subtest 1)r rP)r)rr
rr_�s

z5Test_TestCase.test_subtests_debug.<locals>.Foo.test_aN)rrrr_r
)rr
rr�srr_z	test casez	subtest 1)r#r$�debugr))rrr
)rr�test_subtests_debug�sz!Test_TestCase.test_subtests_debugcCs(Gdd�dtj�}|�|d�jt�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_failureException__default.<locals>.FoocSsdS)Nr
)rr
r
rr�sz>Test_TestCase.test_failureException__default.<locals>.Foo.testN)rrrrr
r
r
rr�srr)r#r$�assertIsr,�AssertionError)rrr
r
r�test_failureException__default�sz,Test_TestCase.test_failureException__defaultcCsXg}t|�}Gdd�dtj�}|�|d�jt�|d��|�dddg}|�||�dS)Nc@seZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.FoocSs
t��dS)N)r;)rr
r
rr�szRTest_TestCase.test_failureException__subclassing__explicit_raise.<locals>.Foo.testN)rrrrr;r,r
r
r
rr�srrr<rFr>)rr#r$rgr,r;r.r))rrr9rr?r
r
r�2test_failureException__subclassing__explicit_raise�s
z@Test_TestCase.test_failureException__subclassing__explicit_raisecCsXg}t|�}Gdd�dtj�}|�|d�jt�|d��|�dddg}|�||�dS)Nc@seZdZdd�ZeZdS)zMTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.FoocSs|�d�dS)Nr
)r2)rr
r
rr�szRTest_TestCase.test_failureException__subclassing__implicit_raise.<locals>.Foo.testN)rrrrr;r,r
r
r
rr�srrr<rFr>)rr#r$rgr,r;r.r))rrr9rr?r
r
r�2test_failureException__subclassing__implicit_raise�s
z@Test_TestCase.test_failureException__subclassing__implicit_raisecCs Gdd�dtj�}|���dS)Nc@seZdZdd�ZdS)z%Test_TestCase.test_setUp.<locals>.FoocSsdS)Nr
)rr
r
rr�sz-Test_TestCase.test_setUp.<locals>.Foo.runTestN)rrrrr
r
r
rr�sr)r#r$r)rrr
r
r�
test_setUp�szTest_TestCase.test_setUpcCs Gdd�dtj�}|���dS)Nc@seZdZdd�ZdS)z(Test_TestCase.test_tearDown.<locals>.FoocSsdS)Nr
)rr
r
rrsz0Test_TestCase.test_tearDown.<locals>.Foo.runTestN)rrrrr
r
r
rrsr)r#r$r!)rrr
r
r�
test_tearDown�szTest_TestCase.test_tearDowncCs(Gdd�dtj�}|�|���t�dS)Nc@seZdZdd�ZdS)z"Test_TestCase.test_id.<locals>.FoocSsdS)Nr
)rr
r
rrsz*Test_TestCase.test_id.<locals>.Foo.runTestN)rrrrr
r
r
rrsr)r#r$�assertIsInstancer*�str)rrr
r
r�test_id
szTest_TestCase.test_idcs\g�t���G��fdd�dtj�}|d���}|�|��ddddddg}|��|�dS)	Ncs$eZdZ�fdd�Z�fdd�ZdS)z;Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foocs��d�dS)Nr)r )r)rr
rrsz@Test_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.testcs�S)Nr
)r)�
defaultResultr
rr6!szMTest_TestCase.test_run__uses_defaultTestResult.<locals>.Foo.defaultTestResultN)rrrrr6r
)rqrr
rrsrrrAr<rXr>rB)rr#r$r.rgr))rrr9r?r
)rqrr� test_run__uses_defaultTestResultsz.Test_TestCase.test_run__uses_defaultTestResultcCs8Gdd�dtj�}t��}|d��|�}|�||�dS)Nc@seZdZdd�ZdS)z9Test_TestCase.test_run__returns_given_result.<locals>.FoocSsdS)Nr
)rr
r
rr1sz>Test_TestCase.test_run__returns_given_result.<locals>.Foo.testN)rrrrr
r
r
rr0srr)r#r$r8r.rg)rrr9�retvalr
r
r�test_run__returns_given_result.sz,Test_TestCase.test_run__returns_given_resultcsDt���t���G��fdd�dtj�}|d���}|�|��dS)Ncs"eZdZdd�Z��fdd�ZdS)zKTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.FoocSsdS)Nr
)rr
r
rrAszPTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.testcs|�|���S)N)rg)rr9)�resultIn�	resultOutr
rr.DszOTest_TestCase.test_call__invoking_an_instance_delegates_to_run.<locals>.Foo.runN)rrrrr.r
)rurvr
rr@srr)r#r8r$rg)rrrsr
)rurvr�0test_call__invoking_an_instance_delegates_to_run<s
z>Test_TestCase.test_call__invoking_an_instance_delegates_to_runcCs|�|���dS)N)�assertIsNone�shortDescription)rr
r
r�$testShortDescriptionWithoutDocstringMsz2Test_TestCase.testShortDescriptionWithoutDocstringr(z)Docstrings are omitted with -O2 and abovecCs|�|��d�dS)Nz7Tests shortDescription() for a method with a docstring.)r)ry)rr
r
r�(testShortDescriptionWithOneLineDocstringPsz6Test_TestCase.testShortDescriptionWithOneLineDocstringcCs|�|��d�dS)Nz>Tests shortDescription() for a method with a longer docstring.)r)ry)rr
r
r�*testShortDescriptionWithMultiLineDocstringXs	z8Test_TestCase.testShortDescriptionWithMultiLineDocstringcCs|�|��d�dS)NzATests shortDescription() whitespace is trimmed, so that the first)r)ry)rr
r
r�&testShortDescriptionWhitespaceTrimmingfsz4Test_TestCase.testShortDescriptionWhitespaceTrimmingcsVGdd�dt������}}|�||k�d�fdd�	}|��|�|�||�dS)Nc@seZdZdS)z7Test_TestCase.testAddTypeEqualityFunc.<locals>.SadSnakeN)rrrr
r
r
r�SadSnakepsr~cs t|�t|�ko�kSS)N)r7)�a�b�msg)r~r
r�AllSnakesCreatedEqualtszDTest_TestCase.testAddTypeEqualityFunc.<locals>.AllSnakesCreatedEqual)N)�object�assertFalseZaddTypeEqualityFuncr))r�s1�s2r�r
)r~r�testAddTypeEqualityFuncosz%Test_TestCase.testAddTypeEqualityFunccCs,t�}|�||�|�|j|j|t��dS)N)r�rgr+r,)r�thingr
r
r�testAssertIs|szTest_TestCase.testAssertIscCs,t�}|�|t��|�|j|j||�dS)N)r�ZassertIsNotr+r,)rr�r
r
r�testAssertIsNot�szTest_TestCase.testAssertIsNotcCs(g}|�|t�|�|j|j|t�dS)N)rn�listr+r,�dict)rr�r
r
r�testAssertIsInstance�sz"Test_TestCase.testAssertIsInstancecCs(g}|�|t�|�|j|j|t�dS)N)ZassertNotIsInstancer�r+r,r�)rr�r
r
r�testAssertNotIsInstance�sz%Test_TestCase.testAssertNotIsInstancecCs�dddd�}|�dd�|�dddd	g�|�d
|�|�dd�|�dddd	g�|�d
|�|�|j|jdd�|�|j|jdddd	g�|�|j|jd|�|�|j|jdd�|�|j|jdddd	g�|�|j|jd|�dS)NZbananaZgrassZfish)�monkey�cowZsealr�abcr(r4r'r��drZotter�x�Zelephantrbr�)�assertIn�assertNotInr+r,)rZanimalsr
r
r�testAssertIn�szTest_TestCase.testAssertInc
Cs�t�����t�dt�|�ii�|�iddi�|�ddiddi�|�ddiddd��|�ddd�ddd��|�|j��|�ddii�WdQRX|�|j��|�ddiddi�WdQRX|�|j��|�ddiddi�WdQRX|�|j��|�ddd�ddi�WdQRX|�|j��|�ddd�ddi�WdQRXd	�d
d�td�D��}|�|j��|�d
|id
di�WdQRXWdQRXdS)N�ignorerr4r()rr��onerb)rrb�css|]}t|�VqdS)N)�chr)�.0rLr
r
r�	<genexpr>�sz=Test_TestCase.testAssertDictContainsSubset.<locals>.<genexpr>�r
u�)	�warnings�catch_warnings�simplefilter�DeprecationWarning�assertDictContainsSubsetr+r,�join�range)rr�r
r
r�testAssertDictContainsSubset�s(  z*Test_TestCase.testAssertDictContainsSubsetc	Cs�diifggft�t�ft�t�fg}x�|D]�\}}y|�||�Wn(|jk
rl|�d||f�YnXy|j||dd�Wn(|jk
r�|�d||f�YnXy|�||d�Wq,|jk
r�|�d||f�Yq,Xq,Wdgfit�ftdd	g�tdd
g�ftddg�td
dg�ftddg�tddg�fg}xT|D]L\}}|�|j|j||�|�|j|j||d�|j|j|j||dd��qFWdS)
N)r
r
zassertEqual(%r, %r) failedr
)r�z$assertEqual(%r, %r) with msg= failedz/assertEqual(%r, %r) with third parameter failedr
r�r4r(�r')�set�	frozensetr)r,r2r+)rZequal_pairsrr�Z
unequal_pairsr
r
r�testAssertEqual�s<
zTest_TestCase.testAssertEqualcCs|�gg�|�dd�|�gd�ddgg}g}|�tjj|j||�|�tjj|jt|�t|��|�tjj|j|t|��|�|�|�||�|�t|�t|��|�|t|��|�t|�|�|�|j|j|t|��|�|j|jt|�|�|�|j|jd|�|�|j|jdt|��|�|j|jdt|��|�|j|jdd�|�|j|jdd�|�|j|jdd�|�	ii�ddi}i}|�tjj|j	||�|�
|�|�	||�d|d<|�tjj|j	||d�|�|j|j	d|�|�|j|j	g|�|�|j|j	dd�dS)Nr
rrr4r�zThese are unequal)�assertListEqual�assertTupleEqual�assertSequenceEqualr+r#r$r,�tuple�extend�assertDictEqual�update)rrr�rbr�r
r
r�testEquality�sT




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





z Test_TestCase.testAssertSetEqualcCs|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�|�|j|jdd�dS)	Nr(r4g�������?g�?ZbugZantsbugsant)r�ZassertGreaterEqualr�ZassertLessEqualr+r,)rr
r
r�testInequalitysbzTest_TestCase.testInequalityc
Csld}d}d}d|_y|�||�WnD|jk
rf}z$t|��dd�d}|�||�Wdd}~XYnXdS)Nzxhttp://www.python.org/doc/2.3/lib/module-unittest.html
test case
    A test case is the smallest unit of testing. [...]
z�http://www.python.org/doc/2.4.1/lib/module-unittest.html
test case
    A test case is the smallest unit of testing. [...] You may provide your
    own implementation that does not subclass from TestCase, of course.
a�- http://www.python.org/doc/2.3/lib/module-unittest.html
?                             ^
+ http://www.python.org/doc/2.4.1/lib/module-unittest.html
?                             ^^^
  test case
-     A test case is the smallest unit of testing. [...]
+     A test case is the smallest unit of testing. [...] You may provide your
?                                                       +++++++++++++++++++++
+     own implementation that does not subclass from TestCase, of course.
r�r4)r�r�r,ro�splitr))r�sample_text�revised_sample_text�sample_text_errorr��errorr
r
r�testAssertMultiLineEqualMsz&Test_TestCase.testAssertMultiLineEqualc
Csfd}d}d}y|�||�WnD|jk
r`}z$t|��dd�d}|�||�Wdd}~XYnXdS)Nzladen swallows fly slowlyzunladen swallows fly quicklyzr- laden swallows fly slowly
?                    ^^^^
+ unladen swallows fly quickly
? ++                   ^^^^^
r�r4)r)r,ror�)rr�r�r�r�r�r
r
r�testAssertEqualSingleLinelsz'Test_TestCase.testAssertEqualSingleLinec
sHtjjr�fdd�}ndd�}|��*���j����dd�WdQRXWdQRX|����dd�WdQRXddg}ddg}|��*���j����||�WdQRXWdQRX|��2���j����t	|�t	|��WdQRXWdQRX|��.���j����
|t	|��WdQRXWdQRX|��.���j����
t	|�|�WdQRXWdQRX|��*���j����
dd�WdQRXWdQRX|��2���j����t|�t|��WdQRXWdQRX���j����|t	|��WdQRX���j����t	|�|�WdQRXddg}dg}���j����||�WdQRX���j����t	|�t	|��WdQRX���j����
|t	|��WdQRX���j����
t	|�|�WdQRX���j����t|�t|��WdQRXdg}ddg}���j����||�WdQRX���j����t	|�t	|��WdQRX���j����
|t	|��WdQRX���j����
t	|�|�WdQRX���j����t|�t|��WdQRX|��2���j����
ddiddi�WdQRXWdQRX���j����
iddi�WdQRX���j����
ddii�WdQRX���j����ddgdddg�WdQRX|����ddgddg�WdQRX|��2���j����ddgddg�WdQRXWdQRX|��6���j����ddggddgg�WdQRXWdQRXdS)Ncs��td�S)Nz#Comparison between bytes and string)�assertWarnsRegex�BytesWarningr
)rr
r�
bytes_warning~sz=Test_TestCase.testEqualityBytesWarning.<locals>.bytes_warningcSst��S)N)�
contextlib�	ExitStackr
r
r
rr��sr�ar)�sys�flagsr�r+r,r)ZassertNotEqualr�r�r�r�r�r�r�r�)rr�rr�r
)rr�testEqualityBytesWarning|s~  ($$ (( (z&Test_TestCase.testEqualityBytesWarningcCs<|�d�|�|j|jd�|�d�|�|j|jd�dS)NFzDjZoPloGears on Rails)rxr+r,ZassertIsNotNone)rr
r
r�testAssertIsNone�s

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

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


z$Test_TestCase.testAssertLogsDefaultsc
Csv|���d|���$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jddiddig�WdQRXdS)	Nr?r��3z
INFO:foo:1zWARNING:quux:3r@r
r)r5rArBrCrDre�log_quuxr(r)rEr>r:)rr�r
r
r�!testAssertLogsTwoMatchingMessagesVs



z/Test_TestCase.testAssertLogsTwoMatchingMessagesc
Csz|���h|j|d��$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jddidd	ig�WdQRXdS)
N)�levelr?r�rGzERROR:foo.bar:2zCRITICAL:quux:3r@zfoo.barr)r5rArBr(rDr�rHZcriticalr)rEr>r:)rrJr�r
r
r�checkAssertLogsPerLevelas


z%Test_TestCase.checkAssertLogsPerLevelcCs|�tj�|�d�dS)N�ERROR)rKr7rL)rr
r
r�testAssertLogsPerLevellsz$Test_TestCase.testAssertLogsPerLevelcCs�|����|jdd��j}|j|dd��$}t�d�t�d�t�d�WdQRX|�|j	ddg�|�
|jdd	idd
ig�WdQRX|�|j	dg�WdQRXdS)N�DEBUG)rJr?r�rGz
INFO:foo:1zDEBUG:foo.bar:2r@r
zfoo.barzWARNING:quux:3)r5rArBrCrDrerHr(r)rEr>r:)rZloggerZouter_cmr�r
r
r�checkAssertLogsPerLoggerps


z&Test_TestCase.checkAssertLogsPerLoggercCs|�t�d��|�d�dS)Nr
)rOr7�	getLogger)rr
r
r�testAssertLogsPerLogger~sz%Test_TestCase.testAssertLogsPerLoggercCsD|���2|�|j��|���WdQRXWdQRXWdQRXdS)N)r5r+r,rA)rr
r
r�testAssertLogsFailureNoLogs�s

z)Test_TestCase.testAssertLogsFailureNoLogscCsR|���@|�|j��(|jdd��t�d�WdQRXWdQRXWdQRXdS)NZWARNING)rJr?)r5r+r,rArBrC)rr
r
r�!testAssertLogsFailureLevelTooHigh�s
z/Test_TestCase.testAssertLogsFailureLevelTooHighcCsV|jddd��>|�|j��&|�d��t�d�WdQRXWdQRXWdQRXdS)NrrL)rJr
r?)rAr+r,rHr�)rr
r
r�&testAssertLogsFailureMismatchingLogger�sz4Test_TestCase.testAssertLogsFailureMismatchingLoggercCs�|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|jdf|j	df|j
tdd�ff|jdf|j
td	d
d�td	d
dd
�ff|jtddd�ff|jdff}x.|D]&\}}|�t��||�WdQRXq�WdS)N)r'r�)r'r')g@g@)g@g@)TcSsddS)Ng��Q�	@Zspamr
)�_r
r
rr��rz9Test_TestCase.testDeprecatedMethodNames.<locals>.<lambda>)Fr4r()rr�r')rr�rbr
cSsidS)Nr
r
r
r
r
rr��r)r�r�)�failIfEqualZassertNotEquals�failUnlessEqualZassertEquals�failUnlessAlmostEqualZassertAlmostEquals�failIfAlmostEqualZassertNotAlmostEquals�
failUnlessZassert_�failUnlessRaisesr�failIfr�r�ZassertRaisesRegexp�KeyErrorZassertRegexpMatchesrr�)r�oldZmethr�r
r
r�testDeprecatedMethodNames�s$z'Test_TestCase.testDeprecatedMethodNamesc
Cs\tjdd�dkrdSddddddd	d
g}x,|D]$}|�t��t||�WdQRXq0WdS)Nr()r'r'rVrWrXrYrZr[r\r�)r��version_infor+r-r9)rZdeprecated_namesZdeprecated_namer
r
r�_testDeprecatedFailMethods�s
z(Test_TestCase._testDeprecatedFailMethodscCs&Gdd�dtj�}|d�}t|�dS)Nc@seZdZdd�ZdS)z0Test_TestCase.testDeepcopy.<locals>.TestableTestcSsdS)Nr
)rr
r
r�testNothing�sz<Test_TestCase.testDeepcopy.<locals>.TestableTest.testNothingN)rrrrbr
r
r
r�TestableTest�srcrb)r#r$r)rrcrr
r
r�testDeepcopy�szTest_TestCase.testDeepcopycCsZt�d�}xJttjd�D]8}tj||d�}t�|�}|�||�|�t�t��qWdS)Nr.r4)�protocol)	r#r$r��pickleZHIGHEST_PROTOCOL�dumps�loadsr)r�)rrreZpickled_testZunpickled_testr
r
r�
testPickle�s

zTest_TestCase.testPicklec
s�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}x6||||fD]&}|�t��|d
���WdQRXq|WdS)NcSst�dS)N)�KeyboardInterrupt)rr
r
r�_raise�sz3Test_TestCase.testKeyboardInterrupt.<locals>._raisecSsdS)Nr
)rr
r
r�nothing�sz4Test_TestCase.testKeyboardInterrupt.<locals>.nothingcseZdZ�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test1N)rrr�test_somethingr
)rkr
r�Test1�srncseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test2N)rrrrrmr
)rkrlr
r�Test2�srocseZdZ�Z�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test3N)rrrrmr!r
)rkrlr
r�Test3�srpcseZdZ�fdd�ZdS)z2Test_TestCase.testKeyboardInterrupt.<locals>.Test4cs|���dS)N)r�)r)rkr
rrm�szATest_TestCase.testKeyboardInterrupt.<locals>.Test4.test_somethingN)rrrrmr
)rkr
r�Test4�srqrm)N)r#r$r+rjr.)rrnrorprq�klassr
)rkrlr�testKeyboardInterrupt�s
z#Test_TestCase.testKeyboardInterruptcs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xJ||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�q|WdS)NcSst�d��dS)Nzsome reason)r#ZSkipTest)rr
r
r�_skip�sz3Test_TestCase.testSkippingEverywhere.<locals>._skipcSsdS)Nr
)rr
r
rrl�sz5Test_TestCase.testSkippingEverywhere.<locals>.nothingcseZdZ�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test1N)rrrrmr
)rtr
rrn�srncseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test2N)rrrrrmr
)rtrlr
rro�srocseZdZ�Z�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test3N)rrrrmr!r
)rtrlr
rrpsrpcseZdZ�fdd�ZdS)z3Test_TestCase.testSkippingEverywhere.<locals>.Test4cs|���dS)N)r�)r)rtr
rrmszBTest_TestCase.testSkippingEverywhere.<locals>.Test4.test_somethingN)rrrrmr
)rtr
rrqsrqrmr4)N)r#r$r8r.r)r�Zskipped�testsRun)rrnrorprqrrr9r
)rtrlr�testSkippingEverywhere�s
z$Test_TestCase.testSkippingEverywherecs�ddd��dd��G�fdd�dtj�}G��fdd�dtj�}G��fd	d
�d
tj�}G�fdd�dtj�}xJ||||fD]:}t��}|d
��|�|�t|j�d�|�|jd�q|WdS)NcSst�dS)N)�
SystemExit)rr
r
rrksz,Test_TestCase.testSystemExit.<locals>._raisecSsdS)Nr
)rr
r
rrlsz-Test_TestCase.testSystemExit.<locals>.nothingcseZdZ�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test1N)rrrrmr
)rkr
rrnsrncseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test2N)rrrrrmr
)rkrlr
rrosrocseZdZ�Z�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test3N)rrrrmr!r
)rkrlr
rrpsrpcseZdZ�fdd�ZdS)z+Test_TestCase.testSystemExit.<locals>.Test4cs|���dS)N)r�)r)rkr
rrm"sz:Test_TestCase.testSystemExit.<locals>.Test4.test_somethingN)rrrrmr
)rkr
rrq!srqrmr4)N)r#r$r8r.r)r��errorsru)rrnrorprqrrr9r
)rkrlr�testSystemExits
zTest_TestCase.testSystemExitc	Cs8t��}t�|�}t���~|�|��WdQRXdS)N)r#r$�weakref�refrZ
disable_gcr�)rr�Zwrr
r
r�testNoCycles+s


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

z$Test_TestCase.test_no_exception_leakN)rrrrrrZeq_pairsrZne_pairsr/r0r3r5r:r@rCrDrErGrHrIrJrKrRrUrVrWrYrZr\rdrfrirjrkrlrmrprrrtrwrzr#ZskipIfr�r��optimizer{r|r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r
rrrrrrr r%r,r-r0r1r2r��contextmanagerr5r>rFrIrKrMrOrQrRrSrTr_rardrirsrvryrZcpython_onlyr|rr
r
r
rr%9s�

		


	
	
%4($>(:L!
1!-	
r%�__main__)"r�r�r�rfrr�r7r�rzr&r�copyrrrr#Zunittest.test.supportrrrrrZtest.supportr	rPrBrDrHr�rr$r%r�mainr
r
r
r�<module>sH


#