AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/internet/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/internet/test/__pycache__/test_asyncioreactor.cpython-310.pyc
o

�bo$�@s�dZddlZddlZddlmZmZmZmZmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZd
Zd
Zzej�d�rMddlmZmZd
Zd
ZWn	eyWYnwGdd�dee�ZdS)z/
Tests for L{twisted.internet.asyncioreactor}.
�N)�DefaultEventLoopPolicy�Future�SelectorEventLoop�set_event_loop�set_event_loop_policy)�skipIf)�AsyncioSelectorReactor)�platform)�SynchronousTestCase�)�ReactorBuilderF�win32)�WindowsProactorEventLoopPolicy�WindowsSelectorEventLoopPolicyTc	@s*eZdZdZe���Zeee�Z	dd�Z
ee	d�e
e�ejjejje����dd��Zee	d�e
e�ejjejje����dd��Zee	d	�e
e�ejjejje����d
d��Zeed�d
d��Zeed�dd��Zeed�dd��Zeed�dd��Zdd�Zdd�Zdd�Zdd�Z d S)!�AsyncioSelectorReactorTestsz*
    L{AsyncioSelectorReactor} tests.
    csXt�}g���fdd�}|�|�|�d�|��g�|j�dd�|��dg�dS)zn
        Ensure that C{reactor} has an event loop that works
        properly with L{asyncio.Future}.
        cs��|������dS�N)�append�result�stop)�future��reactorr��K/usr/lib/python3/dist-packages/twisted/internet/test/test_asyncioreactor.py�	completed7szRAsyncioSelectorReactorTests.assertReactorWorksWithAsyncioFuture.<locals>.completedTr)�timeoutN)r�add_done_callback�
set_result�assertEqual�
runReactor)�selfrrrrrr�#assertReactorWorksWithAsyncioFuture/s

z?AsyncioSelectorReactorTests.assertReactorWorksWithAsyncioFuturezLdefault event loop: {}
is not of type SelectorEventLoop on Python {}.{} ({})cCst�}|�|�dS)a
        L{AsyncioSelectorReactor} wraps the global policy's event loop
        by default.  This ensures that L{asyncio.Future}s and
        coroutines created by library code that uses
        L{asyncio.get_event_loop} are bound to the same loop.
        N)rr!�r rrrr�-test_defaultSelectorEventLoopFromGlobalPolicyBszIAsyncioSelectorReactorTests.test_defaultSelectorEventLoopFromGlobalPolicycC�0t���}t|�}t|�|�|�td�dS)z�
        If we use the L{asyncio.DefaultLoopPolicy} to create a new event loop,
        and then pass that event loop to a new L{AsyncioSelectorReactor},
        this reactor should work properly with L{asyncio.Future}.
        N)r�new_event_looprrr!r�r �
event_looprrrr�3test_newSelectorEventLoopFromDefaultEventLoopPolicyVs


zOAsyncioSelectorReactorTests.test_newSelectorEventLoopFromDefaultEventLoopPolicyzHdefault event loop: {}
is of type SelectorEventLoop on Python {}.{} ({})cCs|�tt�dS)ay
        On Windows Python 3.5 to 3.7, L{get_event_loop()} returns a
        L{WindowsSelectorEventLoop} by default.
        On Windows Python 3.8+, L{get_event_loop()} returns a
        L{WindowsProactorEventLoop} by default.
        L{AsyncioSelectorReactor} should raise a
        L{TypeError} if the default event loop is not a
        L{WindowsSelectorEventLoop}.
        N)�assertRaises�	TypeErrorr�r rrr�1test_defaultNotASelectorEventLoopFromGlobalPolicylszMAsyncioSelectorReactorTests.test_defaultNotASelectorEventLoopFromGlobalPolicyz&WindowsProactorEventLoop not availablecCst���}|�tt|�dS)z�
        L{AsyncioSelectorReactor} will raise a L{TypeError}
        if instantiated with a L{asyncio.WindowsProactorEventLoop}
        N)rr%r)r*r)r r'rrr�test_WindowsProactorEventLoop�s
z9AsyncioSelectorReactorTests.test_WindowsProactorEventLoopz(WindowsSelectorEventLoop only on WindowscCr$)zR
        L{WindowsSelectorEventLoop} works with L{AsyncioSelectorReactor}
        N)rr%rrr!rr&rrr�test_WindowsSelectorEventLoop�s


z9AsyncioSelectorReactorTests.test_WindowsSelectorEventLoopz.WindowsProactorEventLoopPolicy only on WindowscCsFtt��|�t��t�Wd�n1swYtd�dS)z�
        L{AsyncioSelectorReactor} will raise a L{TypeError}
        if L{asyncio.WindowsProactorEventLoopPolicy} is default.
        N)rrr)r*rr+rrr�#test_WindowsProactorEventLoopPolicy�s

	�z?AsyncioSelectorReactorTests.test_WindowsProactorEventLoopPolicyz.WindowsSelectorEventLoopPolicy only on WindowscCs&tt��t�}|�|�td�dS)zy
        L{AsyncioSelectorReactor} will work if
        if L{asyncio.WindowsSelectorEventLoopPolicy} is default.
        N)rrrr!r"rrr�#test_WindowsSelectorEventLoopPolicy�s
	
z?AsyncioSelectorReactorTests.test_WindowsSelectorEventLoopPolicycCsHtrtt��t�}|��}|�|d�|�|d�tr"td�dSdS)z0L{seconds} should return a plausible epoch time.i�^l#G4N)�!hasWindowsSelectorEventLoopPolicyrrr�seconds�
assertGreater�
assertLess)r rrrrr�test_seconds�s
�z(AsyncioSelectorReactorTests.test_secondscs�trtt��t��dg���fdd�}���}��d|�}|�d���d�j����|�	�d�|�
�d|d�trGtd�dSdS)zQ
        L{DelayedCall.reset()} properly reschedules timer to later time
        Nc�����d<dS�Nr�r2r�r�timer_called_atrr�on_timer��zJAsyncioSelectorReactorTests.test_delayedCallResetToLater.<locals>.on_timerr��?r皙�����?)r1rrrr2�	callLater�resetr�run�assertIsNotNoner3)r r;�
start_time�dcrr9r�test_delayedCallResetToLater�s

�z8AsyncioSelectorReactorTests.test_delayedCallResetToLatercs�trtt��t��dg���fdd�}���}��d|�}|�d���d�j�ddl}ddl	m
}|��}||�����Wd�n1sKwY|�
|��d�|��d�|��d|d	�trqtd�dSdS)
zS
        L{DelayedCall.reset()} properly reschedules timer to earlier time
        Ncr6r7r8rr9rrr;�r<zLAsyncioSelectorReactorTests.test_delayedCallResetToEarlier.<locals>.on_timerr=rr)�redirect_stderr�r>)r1rrrr2r?r@r�io�
contextlibrF�StringIOrAr�getvaluerBr4)r r;rCrDrHrF�stderrrr9r�test_delayedCallResetToEarlier�s*



��z:AsyncioSelectorReactorTests.test_delayedCallResetToEarliercCs�trtt��t��}t��z6tt���}d}t�}t	|�D]
}|�
ddd��q|��tt���}|�|||d�W|rEt�
�n|rMt�
�wwtrVtd�dSdS)zW
        L{AsyncioSelectorReactor.callLater()} doesn't leave cyclic references
        i�rcSsdSrrrrrr�<lambda>szOAsyncioSelectorReactorTests.test_noCycleReferencesInCallLater.<locals>.<lambda>rN)r1rr�gc�	isenabled�disable�len�get_objectsr�ranger?�runUntilCurrentr4�enable)r �gc_was_enabled�objects_before�timer_countr�_�
objects_afterrrr�!test_noCycleReferencesInCallLater�s,
��
��z=AsyncioSelectorReactorTests.test_noCycleReferencesInCallLaterN)!�__name__�
__module__�__qualname__�__doc__rr%�_defaultEventLoop�
isinstancer�_defaultEventLoopIsSelectorr!r�format�type�sys�version_info�major�minorr	�getTyper#r(r,�!hasWindowsProactorEventLoopPolicyr-r1r.r/r0r5rErMr\rrrrr'sz

��


��

��

�
�

�

�

r)r`rOrf�asynciorrrrr�unittestr�twisted.internet.asyncioreactorr�twisted.python.runtimer	�twisted.trial.unittestr
�
reactormixinsrrkr1�
startswithrr�ImportErrorrrrrr�<module>s*��

Anon7 - 2022
AnonSec Team