403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.230
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/unittest/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/unittest/test/__pycache__/test_assertions.cpython-36.pyc
3

x2_�B�@sdddlZddlZddlZddlZddlmZGdd�dej�ZGdd�dej�Ze	dkr`ej
�dS)�N)�productc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�Test_AssertionscCs�|jdd�|jdd�|j|j|jdd�|j|j|jdd�|jdddd�|j|j|jdddd�|jdddd�|jdddd�|j|j|jdd
dd�|j|j|jdddd�|jtd
�td
��|j|j|jtd
�td
��dS)Ng�1��?g�?g����?g�������?r)�places�g�������?y�������?�infy�������?�������?y�������?�������?y�������?�������?y�������?�������?)�assertAlmostEqual�assertNotAlmostEqual�assertRaises�failureException�float)�self�r
�B/opt/alt/python36/lib64/python3.6/unittest/test/test_assertions.py�test_AlmostEqual	s$z Test_Assertions.test_AlmostEqualcCs|jdddd�|jdddd�|jdddd�|jdddd�|jdddd�|j|j|jdddd�|j|j|jdddd�|j|j|jdddd�|jt|jddddd�|jt|jddddd�tjj�}|tjdd	�}|j||tjd
d	�d�|j||tjdd	�d�dS)Ng�������?g�?g�?)�deltag�������?�)rr�
)Zseconds��)rrr	r
�	TypeError�datetimeZnowZ	timedelta)r�first�secondr
r
r�test_AmostEqualWithDelta s*


z(Test_Assertions.test_AmostEqualWithDeltacOCs�dd�}|jt|t�|jt|td��y|jtdd��Wn4|jk
rp}z|jdt|��WYdd}~XnX|jd�y|jt|t�Wntk
r�YnX|jd�|jt��8}yt�Wn(tk
r�}z|}�WYdd}~XnXWdQRX|j|j	|�|jt��td��WdQRXy|jt��WdQRXWn6|jk
�rr}z|jdt|��WYdd}~XnX|jd�y|jt��
t�WdQRXWntk
�r�YnX|jd�dS)	NcSs|�dS)Nr
)�er
r
r�_raise<sz1Test_Assertions.test_assertRaises.<locals>._raise�keycSsdS)Nr
r
r
r
r�<lambda>Asz3Test_Assertions.test_assertRaises.<locals>.<lambda>zKeyError not raisedzassertRaises() didn't failz0assertRaises() didn't let exception pass through)
r	�KeyErrorr
�assertIn�str�fail�
ValueError�	Exception�assertIsZ	exception)rrr�cm�excr
r
r�test_assertRaises;sD"

"
z!Test_Assertions.test_assertRaisescs^Gdd�d��d�G��fdd�dtj�}|d�j�|j���|d�j�|j���dS)Nc@seZdZdS)z<Test_Assertions.test_assertRaises_frames_survival.<locals>.AN)�__name__�
__module__�__qualname__r
r
r
r�Ahsr+cs*eZdZ��fdd�Zdd�Zdd�ZdS)z>Test_Assertions.test_assertRaises_frames_survival.<locals>.Foocs6��}tj|��yt�Wntk
r0t�YnXdS)N)�weakref�ref�IOErrorr")r�a)r+�wrr
r�foons
zBTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.foocSs|jt|j�dS)N)r	r"r1)rr
r
r�test_functionalwszNTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.test_functionalc	Ss"|jt��|j�WdQRXdS)N)r	r"r1)rr
r
r�	test_withzszHTest_Assertions.test_assertRaises_frames_survival.<locals>.Foo.test_withN)r(r)r*r1r2r3r
)r+r0r
r�Fools	r4r2r3)�unittest�TestCaseZrun�assertIsNone)rr4r
)r+r0r�!test_assertRaises_frames_survivalesz1Test_Assertions.test_assertRaises_frames_survivalcCsd|jdd�y|jddd�Wn6|jk
rT}z|jd|jd�WYdd}~XnX|jd�dS)NzAla ma kotazr+zk.tZMessagerz"assertNotRegex should have failed.)�assertNotRegexr
r�argsr!)rrr
r
r�testAssertNotRegex�s$z"Test_Assertions.testAssertNotRegexN)r(r)r*rrr'r8r;r
r
r
rrs
*rc@seZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�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.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDS)E�TestLongMessagez�Test that the individual asserts honour longMessage.
    This actually tests all the message behaviour for
    asserts that use longMessage.csDG�fdd�dtj�}G�fdd�dtj�}|d��_|d��_dS)NcseZdZdZ�jZdd�ZdS)z0TestLongMessage.setUp.<locals>.TestableTestFalseFcSsdS)Nr
)rr
r
r�testTest�sz9TestLongMessage.setUp.<locals>.TestableTestFalse.testTestN)r(r)r*�longMessager
r=r
)rr
r�TestableTestFalse�sr?cseZdZdZ�jZdd�ZdS)z/TestLongMessage.setUp.<locals>.TestableTestTrueTcSsdS)Nr
)rr
r
rr=�sz8TestLongMessage.setUp.<locals>.TestableTestTrue.testTestN)r(r)r*r>r
r=r
)rr
r�TestableTestTrue�sr@r=)r5r6�testableTrue�
testableFalse)rr?r@r
)rr�setUp�s
zTestLongMessage.setUpcCs|jtjj�dS)N)�
assertTruer5r6r>)rr
r
r�testDefault�szTestLongMessage.testDefaultcCsl|j|jjdd�d�|j|jjdd�d�|j|jjdd�d�|j|jjdd�d�|jjt�d�dS)Nr1�barz	bar : foo)ZassertEqualrB�_formatMessagerA�object)rr
r
r�test_formatMsg�s
zTestLongMessage.test_formatMsgcCs*djdd�td�D��}|jj|d�dS)N�css|]}t|�VqdS)N)�chr)�.0�ir
r
r�	<genexpr>�szCTestLongMessage.test_formatMessage_unicode_error.<locals>.<genexpr>�u�)�join�rangerArG)rZoner
r
r� test_formatMessage_unicode_error�sz0TestLongMessage.test_formatMessage_unicode_errorc
sn��fdd�}xZt|�D]N\}}||�}i}|d}	|	r@ddi}�j�j|d��|||�WdQRXqWdS)a_
        Check that methodName(*args) raises the correct error messages.
        errors should be a list of 4 regex that match the error when:
          1) longMessage = False and no msg passed;
          2) longMessage = False and msg passed;
          3) longMessage = True and no msg passed;
          4) longMessage = True and msg passed;
        cs$|dk}|r�j}n�j}t|��S)Nr)rBrA�getattr)rMZuseTestableFalseZtest)�
methodNamerr
r�	getMethod�s
z1TestLongMessage.assertMessages.<locals>.getMethodr�msg�oops)�expected_regexN)�	enumerate�assertRaisesRegexr
)
rrTr:�errorsrUrMrXZ
testMethod�kwargsZwithMsgr
)rTrr�assertMessages�s	
zTestLongMessage.assertMessagescCs|jddddddg�dS)NrDFz^False is not true$z^oops$z^False is not true : oops$)F)r])rr
r
r�testAssertTrue�szTestLongMessage.testAssertTruecCs|jddddddg�dS)NZassertFalseTz^True is not false$z^oops$z^True is not false : oops$)T)r])rr
r
r�testAssertFalse�szTestLongMessage.testAssertFalsecCs|jddddddg�dS)NZassertNotEqualrz^1 == 1$z^oops$z^1 == 1 : oops$)rr)r])rr
r
r�testNotEqual�szTestLongMessage.testNotEqualcCs|jddddddg�dS)Nrrrz^1 != 2 within 7 places$z^oops$z^1 != 2 within 7 places : oops$)rr)r])rr
r
r�testAlmostEqual�szTestLongMessage.testAlmostEqualcCs|jddddddg�dS)Nrrz^1 == 1 within 7 places$z^oops$z^1 == 1 within 7 places : oops$)rr)r])rr
r
r�testNotAlmostEqual�sz"TestLongMessage.testNotAlmostEqualcCs|jddddddg�dS)NZ_baseAssertEqualrrz^1 != 2$z^oops$z^1 != 2 : oops$)rr)r])rr
r
r�test_baseAssertEqual�sz$TestLongMessage.test_baseAssertEqualcCs |jdgdgfddddg�dS)NZassertSequenceEqualz\+ \[None\]$z^oops$z\+ \[None\] : oops$)r])rr
r
r�testAssertSequenceEqual�sz'TestLongMessage.testAssertSequenceEqualcCs&|jdt�tdg�fddddg�dS)NZassertSetEqualzNone$z^oops$zNone : oops$)r]�set)rr
r
r�testAssertSetEqual�sz"TestLongMessage.testAssertSetEqualcCs|jddgfddddg�dS)Nrz^None not found in \[\]$z^oops$z^None not found in \[\] : oops$)r])rr
r
r�testAssertIn�szTestLongMessage.testAssertIncCs |jdddgfddddg�dS)NZassertNotInz%^None unexpectedly found in \[None\]$z^oops$z,^None unexpectedly found in \[None\] : oops$)r])rr
r
r�testAssertNotInszTestLongMessage.testAssertNotIncCs"|jdiddifddddg�dS)NZassertDictEqualr�valuez\+ \{'key': 'value'\}$z^oops$z\+ \{'key': 'value'\} : oops$)r])rr
r
r�testAssertDictEqualsz#TestLongMessage.testAssertDictEqualcCsBtj��0tjdt�|jdddiifddddg�WdQRXdS)N�ignoreZassertDictContainsSubsetrriz^Missing: 'key'$z^oops$z^Missing: 'key' : oops$)�warnings�catch_warnings�simplefilter�DeprecationWarningr])rr
r
r�testAssertDictContainsSubset
s
z,TestLongMessage.testAssertDictContainsSubsetcCs|jddddddg�dS)NZassertMultiLineEqualrJr1z\+ foo$z^oops$z\+ foo : oops$)rJr1)r])rr
r
r�testAssertMultiLineEqualsz(TestLongMessage.testAssertMultiLineEqualcCs|jddddddg�dS)NZ
assertLessrrz^2 not less than 1$z^oops$z^2 not less than 1 : oops$)rr)r])rr
r
r�testAssertLessszTestLongMessage.testAssertLesscCs|jddddddg�dS)NZassertLessEqualrrz^2 not less than or equal to 1$z^oops$z&^2 not less than or equal to 1 : oops$)rr)r])rr
r
r�testAssertLessEqual!sz#TestLongMessage.testAssertLessEqualcCs|jddddddg�dS)NZ
assertGreaterrrz^1 not greater than 2$z^oops$z^1 not greater than 2 : oops$)rr)r])rr
r
r�testAssertGreater'sz!TestLongMessage.testAssertGreatercCs|jddddddg�dS)NZassertGreaterEqualrrz"^1 not greater than or equal to 2$z^oops$z)^1 not greater than or equal to 2 : oops$)rr)r])rr
r
r�testAssertGreaterEqual-sz&TestLongMessage.testAssertGreaterEqualcCs|jddddddg�dS)Nr7�not Nonez^'not None' is not None$z^oops$z^'not None' is not None : oops$)rv)r])rr
r
r�testAssertIsNone3sz TestLongMessage.testAssertIsNonecCs|jddddddg�dS)NZassertIsNotNonez^unexpectedly None$z^oops$z^unexpectedly None : oops$)N)r])rr
r
r�testAssertIsNotNone9sz#TestLongMessage.testAssertIsNotNonecCs|jddddddg�dS)Nr$r1z^None is not 'foo'$z^oops$z^None is not 'foo' : oops$)Nr1)r])rr
r
r�testAssertIs?szTestLongMessage.testAssertIscCs|jddddddg�dS)NZassertIsNotz^unexpectedly identical: None$z^oops$z%^unexpectedly identical: None : oops$)NN)r])rr
r
r�testAssertIsNotEszTestLongMessage.testAssertIsNotcCs|jddddddg�dS)NZassertRegexr1rFz^Regex didn't match:z^oops$z!^Regex didn't match: (.*) : oops$)r1rF)r])rr
r
r�testAssertRegexKs
zTestLongMessage.testAssertRegexcCs|jddddddg�dS)Nr9r1z^Regex matched:z^oops$z^Regex matched: (.*) : oops$)r1r1)r])rr
r
rr;Rs
z"TestLongMessage.testAssertNotRegexcCszt|j|jfiddif�}xZt||�D]L\\}}}t||�}	|j|j|��"|	||��}
|�WdQRXWdQRXq&WdS)a�
        Check that the correct error messages are raised while executing:
          with method(*args):
              func()
        *errors* should be a list of 4 regex that match the error when:
          1) longMessage = False and no msg passed;
          2) longMessage = False and msg passed;
          3) longMessage = True and no msg passed;
          4) longMessage = True and msg passed;
        rVrWN)rrBrA�ziprSrZr
)rrTr:�funcr[�p�clsr\�err�methodr%r
r
r�assertMessagesCMZs
z TestLongMessage.assertMessagesCMcCs"|jdtfdd�ddddg�dS)Nr	cSsdS)Nr
r
r
r
rrnsz2TestLongMessage.testAssertRaises.<locals>.<lambda>z^TypeError not raised$z^oops$z^TypeError not raised : oops$)r�r)rr
r
r�testAssertRaisesmsz TestLongMessage.testAssertRaisescCsH|jdtdfdd�ddddg�dd	�}|jdtd
f|ddddg�dS)
NrZzunused regexcSsdS)Nr
r
r
r
rrvsz7TestLongMessage.testAssertRaisesRegex.<locals>.<lambda>z^TypeError not raised$z^oops$z^TypeError not raised : oops$cSstd��dS)Nr1)rr
r
r
r�raise_wrong_message{szBTestLongMessage.testAssertRaisesRegex.<locals>.raise_wrong_message�regexz^"regex" does not match "foo"$z%^"regex" does not match "foo" : oops$)r�r)rr�r
r
r�testAssertRaisesRegexssz%TestLongMessage.testAssertRaisesRegexcCs"|jdtfdd�ddddg�dS)NZassertWarnscSsdS)Nr
r
r
r
rr�sz1TestLongMessage.testAssertWarns.<locals>.<lambda>z^UserWarning not triggered$z^oops$z"^UserWarning not triggered : oops$)r��UserWarning)rr
r
r�testAssertWarns�szTestLongMessage.testAssertWarnscCsH|jdtdfdd�ddddg�dd	�}|jdtd
f|ddddg�dS)
NZassertWarnsRegexzunused regexcSsdS)Nr
r
r
r
rr�sz6TestLongMessage.testAssertWarnsRegex.<locals>.<lambda>z^UserWarning not triggered$z^oops$z"^UserWarning not triggered : oops$cSstjd�dS)Nr1)rl�warnr
r
r
rr��szATestLongMessage.testAssertWarnsRegex.<locals>.raise_wrong_messager�z^"regex" does not match "foo"$z%^"regex" does not match "foo" : oops$)r�r�)rr�r
r
r�testAssertWarnsRegex�sz$TestLongMessage.testAssertWarnsRegexN)%r(r)r*�__doc__rCrErIrRr]r^r_r`rarbrcrdrfrgrhrjrprqrrrsrtrurwrxryrzr{r;r�r�r�r�r�r
r
r
rr<�sD
	r<�__main__)rrlr,r5�	itertoolsrr6rr<r(�mainr
r
r
r�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit