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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


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

@��g�B�@sdddlZddlZddlZddlZddlmZGdd�dej�ZGdd�dej�Ze	dkr`e�
�dS)�N)�productc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�Test_AssertionscCs�|�dd�|�dd�|�|j|jdd�|�|j|jdd�|jdddd�|j|j|jdddd�|jdddd�|jdddd�|j|j|jdddd�|j|j|jdddd�|�td	�td	��|�|j|jtd	�td	��dS)
Ng�1��?��?g����?皙�����?r)�places�y�������?�������?�inf)�assertAlmostEqual�assertNotAlmostEqual�assertRaises�failureException�float��self�r�</opt/cppython/lib/python3.8/unittest/test/test_assertions.py�test_AlmostEqual	sL������z Test_Assertions.test_AlmostEqualcCs|jdddd�|jdddd�|jdddd�|jdddd�|jdddd�|j|j|jdddd�|j|j|jdddd�|j|j|jdddd�|jt|jddddd�|jt|jddddd�tj��}|tjdd	�}|j||tjd
d	�d�|j||tjdd	�d�dS)Nrrg�?)�deltag�������?�)rr�
)Zseconds��)r	r
rr�	TypeError�datetimeZnowZ	timedelta)r�first�secondrrr�test_AmostEqualWithDelta sP���
�
�

�
�z(Test_Assertions.test_AmostEqualWithDeltacCs�dd�}|�t|t�|�t|td��z|�tdd��Wn4|jk
rp}z|�dt|��W5d}~XYnX|�d�z|�t|t�Wntk
r�YnX|�d�|�t��8}zt�Wn(tk
r�}z
|}�W5d}~XYnXW5QRX|�|j	|�|�t��td��W5QRXz|�t��W5QRXWn6|jk
�rr}z|�dt|��W5d}~XYnX|�d�z|�t��
t�W5QRXWntk
�r�YnX|�d�dS)	NcSs|�dS�Nr)�errr�_raise<sz1Test_Assertions.test_assertRaises.<locals>._raise�keycSsdSrrrrrr�<lambda>A�z3Test_Assertions.test_assertRaises.<locals>.<lambda>zKeyError not raisedzassertRaises() didn't failz0assertRaises() didn't let exception pass through)
r�KeyErrorr�assertIn�str�fail�
ValueError�	Exception�assertIs�	exception)rrr�cm�excrrr�test_assertRaises;sD"

"
z!Test_Assertions.test_assertRaisescs^Gdd�d��d�G��fdd�dtj�}|d���|����|d���|����dS)Nc@seZdZdS)z<Test_Assertions.test_assertRaises_frames_survival.<locals>.AN)�__name__�
__module__�__qualname__rrrr�Ahsr1cs*eZdZ��fdd�Zdd�Zdd�ZdS)z>Test_Assertions.test_assertRaises_frames_survival.<locals>.Foocs6��}t�|��zt�Wntk
r0t�YnXdSr)�weakref�ref�OSErrorr')r�a�r1�wrrr�foons
zBTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.foocSs|�t|j�dSr�rr'r8rrrr�test_functionalwszNTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.test_functionalc	Ss"|�t��|��W5QRXdSrr9rrrr�	test_withzszHTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.test_withN)r.r/r0r8r:r;rr6rr�Fools	r<r:r;)�unittest�TestCase�run�assertIsNone)rr<rr6r�!test_assertRaises_frames_survivalesz1Test_Assertions.test_assertRaises_frames_survivalc
Csd|�dd�z|�ddd�Wn6|jk
rT}z|�d|jd�W5d}~XYnX|�d�dS)NzAla ma kotazr+zk.tZMessagerz"assertNotRegex should have failed.)�assertNotRegexrr$�argsr&)rrrrr�testAssertNotRegex�s$z"Test_Assertions.testAssertNotRegexN)r.r/r0rrr-rArDrrrrrs
*rc@seZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCS)D�TestLongMessagecsDG�fdd�dtj�}G�fdd�dtj�}|d��_|d��_dS)NcseZdZdZ�jZdd�ZdS)z0TestLongMessage.setUp.<locals>.TestableTestFalseFcSsdSrrrrrr�testTest�sz9TestLongMessage.setUp.<locals>.TestableTestFalse.testTestN�r.r/r0�longMessagerrFrrrr�TestableTestFalse�srIcseZdZdZ�jZdd�ZdS)z/TestLongMessage.setUp.<locals>.TestableTestTrueTcSsdSrrrrrrrF�sz8TestLongMessage.setUp.<locals>.TestableTestTrue.testTestNrGrrrr�TestableTestTrue�srJrF)r=r>�testableTrue�
testableFalse)rrIrJrrr�setUp�s
zTestLongMessage.setUpcCs|�tjj�dSr)�
assertTruer=r>rHrrrr�testDefault�szTestLongMessage.testDefaultcCsl|�|j�dd�d�|�|j�dd�d�|�|j�dd�d�|�|j�dd�d�|j�t�d�dS)Nr8�barz	bar : foo)ZassertEqualrL�_formatMessagerK�objectrrrr�test_formatMsg�s
zTestLongMessage.test_formatMsgcCs*d�dd�td�D��}|j�|d�dS)N�css|]}t|�VqdSr)�chr)�.0�irrr�	<genexpr>�szCTestLongMessage.test_formatMessage_unicode_error.<locals>.<genexpr>�u�)�join�rangerKrQ)rZonerrr� test_formatMessage_unicode_error�sz0TestLongMessage.test_formatMessage_unicode_errorc

sj��fdd�}t|�D]N\}}||�}i}|d}	|	r>ddi}�j�j|d��|||�W5QRXqdS)Ncs$|dk}|r�j}n�j}t|��S)Nr)rLrK�getattr)rWZuseTestableFalse�test��
methodNamerrr�	getMethod�s
z1TestLongMessage.assertMessages.<locals>.getMethodr�msg�oops)�expected_regex)�	enumerate�assertRaisesRegexr)
rr`rC�errorsrarWrdZ
testMethod�kwargsZwithMsgrr_r�assertMessages�s	�zTestLongMessage.assertMessagescCs|�ddddddg�dS)NrN)Fz^False is not true$�^oops$z^False is not true : oops$�rirrrr�testAssertTrue�s
��zTestLongMessage.testAssertTruecCs|�ddddddg�dS)NZassertFalse)Tz^True is not false$rjz^True is not false : oops$rkrrrr�testAssertFalse�s
��zTestLongMessage.testAssertFalsecCs|�ddddddg�dS)NZassertNotEqual�rrz^1 == 1$rjz^1 == 1 : oops$rkrrrr�testNotEqual�s
��zTestLongMessage.testNotEqualcCs|�ddddddg�dS)Nr	�rrz)^1 != 2 within 7 places \(1 difference\)$rjz0^1 != 2 within 7 places \(1 difference\) : oops$rkrrrr�testAlmostEqual�s��zTestLongMessage.testAlmostEqualcCs|�ddddddg�dS)Nr
rnz^1 == 1 within 7 places$rjz^1 == 1 within 7 places : oops$rkrrrr�testNotAlmostEqual�s��z"TestLongMessage.testNotAlmostEqualcCs|�ddddddg�dS)NZ_baseAssertEqualrpz^1 != 2$rjz^1 != 2 : oops$rkrrrr�test_baseAssertEqual�s
�z$TestLongMessage.test_baseAssertEqualcCs |�dgdgfddddg�dS)NZassertSequenceEqualz\+ \[None\]$rjz\+ \[None\] : oops$rkrrrr�testAssertSequenceEqual�s
��z'TestLongMessage.testAssertSequenceEqualcCs&|�dt�tdg�fddddg�dS)NZassertSetEqualzNone$rjzNone : oops$)ri�setrrrr�testAssertSetEqual�s
��z"TestLongMessage.testAssertSetEqualcCs|�ddgfddddg�dS)Nr$z^None not found in \[\]$rjz^None not found in \[\] : oops$rkrrrr�testAssertIn�s��zTestLongMessage.testAssertIncCs |�dddgfddddg�dS)NZassertNotInz%^None unexpectedly found in \[None\]$rjz,^None unexpectedly found in \[None\] : oops$rkrrrr�testAssertNotIns��zTestLongMessage.testAssertNotIncCs"|�diddifddddg�dS)NZassertDictEqualr �valuez\+ \{'key': 'value'\}$rjz\+ \{'key': 'value'\} : oops$rkrrrr�testAssertDictEqual	s��z#TestLongMessage.testAssertDictEqualc	CsBt���0t�dt�|�dddiifddddg�W5QRXdS)N�ignoreZassertDictContainsSubsetr ryz^Missing: 'key'$rjz^Missing: 'key' : oops$)�warnings�catch_warnings�simplefilter�DeprecationWarningrirrrr�testAssertDictContainsSubsets
��z,TestLongMessage.testAssertDictContainsSubsetcCs|�ddddddg�dS)NZassertMultiLineEqual)rTr8z\+ foo$rjz\+ foo : oops$rkrrrr�testAssertMultiLineEquals��z(TestLongMessage.testAssertMultiLineEqualcCs|�ddddddg�dS)NZ
assertLess�rrz^2 not less than 1$rjz^2 not less than 1 : oops$rkrrrr�testAssertLesss��zTestLongMessage.testAssertLesscCs|�ddddddg�dS)NZassertLessEqualr�z^2 not less than or equal to 1$rjz&^2 not less than or equal to 1 : oops$rkrrrr�testAssertLessEqual#s��z#TestLongMessage.testAssertLessEqualcCs|�ddddddg�dS)NZ
assertGreaterrpz^1 not greater than 2$rjz^1 not greater than 2 : oops$rkrrrr�testAssertGreater)s��z!TestLongMessage.testAssertGreatercCs|�ddddddg�dS)NZassertGreaterEqualrpz"^1 not greater than or equal to 2$rjz)^1 not greater than or equal to 2 : oops$rkrrrr�testAssertGreaterEqual/s��z&TestLongMessage.testAssertGreaterEqualcCs|�ddddddg�dS)Nr@)znot Nonez^'not None' is not None$rjz^'not None' is not None : oops$rkrrrr�testAssertIsNone5s��z TestLongMessage.testAssertIsNonecCs|�ddddddg�dS)NZassertIsNotNonerz^unexpectedly None$rjz^unexpectedly None : oops$rkrrrr�testAssertIsNotNone;s��z#TestLongMessage.testAssertIsNotNonecCs|�ddddddg�dS)Nr)�Nr8z^None is not 'foo'$rjz^None is not 'foo' : oops$rkrrrr�testAssertIsAs��zTestLongMessage.testAssertIscCs|�ddddddg�dS)NZassertIsNot)NNz^unexpectedly identical: None$rjz%^unexpectedly identical: None : oops$rkrrrr�testAssertIsNotGs��zTestLongMessage.testAssertIsNotcCs|�ddddddg�dS)NZassertRegex)r8rPz^Regex didn't match:rjz!^Regex didn't match: (.*) : oops$rkrrrr�testAssertRegexMs��zTestLongMessage.testAssertRegexcCs|�ddddddg�dS)NrB)r8r8z^Regex matched:rjz^Regex matched: (.*) : oops$rkrrrrrDTs��z"TestLongMessage.testAssertNotRegexcCsvt|j|jfiddif�}t||�D]L\\}}}t||�}	|�|j|��"|	||��}
|�W5QRXW5QRXq$dS)Nrbrc)rrLrK�zipr]rfr)rr`rC�funcrg�p�clsrh�err�methodr+rrr�assertMessagesCM\s
�
z TestLongMessage.assertMessagesCMc	Cs"|�dtfdd�ddddg�dS)NrcSsdSrrrrrrr!pr"z2TestLongMessage.testAssertRaises.<locals>.<lambda>�^TypeError not raised$rj�^TypeError not raised : oops$�r�rrrrr�testAssertRaisesos��z TestLongMessage.testAssertRaisesc	CsH|�dtdfdd�ddddg�dd	�}|�dtd
f|ddddg�dS)
Nrf�unused regexcSsdSrrrrrrr!xr"z7TestLongMessage.testAssertRaisesRegex.<locals>.<lambda>r�rjr�cSstd��dSr�)rrrrr�raise_wrong_message}szBTestLongMessage.testAssertRaisesRegex.<locals>.raise_wrong_message�regex�^"regex" does not match "foo"$�%^"regex" does not match "foo" : oops$r��rr�rrr�testAssertRaisesRegexus����z%TestLongMessage.testAssertRaisesRegexc	Cs"|�dtfdd�ddddg�dS)NZassertWarnscSsdSrrrrrrr!�r"z1TestLongMessage.testAssertWarns.<locals>.<lambda>�^UserWarning not triggered$rj�"^UserWarning not triggered : oops$�r��UserWarningrrrr�testAssertWarns�s��zTestLongMessage.testAssertWarnsc	CsH|�dtdfdd�ddddg�dd	�}|�dtd
f|ddddg�dS)
NZassertWarnsRegexr�cSsdSrrrrrrr!�r"z6TestLongMessage.testAssertWarnsRegex.<locals>.<lambda>r�rjr�cSst�d�dSr�)r|�warnrrrrr��szATestLongMessage.testAssertWarnsRegex.<locals>.raise_wrong_messager�r�r�r�r�rrr�testAssertWarnsRegex�s����z$TestLongMessage.testAssertWarnsRegexN)$r.r/r0rMrOrSr\rirlrmrorqrrrsrtrvrwrxrzr�r�r�r�r�r�r�r�r�r�r�rDr�r�r�r�r�rrrrrE�sB
	rE�__main__)rr|r2r=�	itertoolsrr>rrEr.�mainrrrr�<module>s

F1le Man4ger