CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_error.cpython-310.pyc

o

�b�"�@snddlZddlZddlmZddlmZddlmZGdd�dej�Z	Gdd�dej�Z
Gd	d
�d
ej�ZdS)�N)�error)�platformType)�unittestc@s6eZdZdZgdejf�dejdgf�dejddgf�dejdd	e�d
�ff�dejf�dejddgf�d
ej	f�dej	ddgf�dej
f�dej
dgf�dej
gddif�dej
ddgf�dejf�dejdgf�dejddgf�dejf�dej
f�dejf�dejf�dejf�dejf�dejf�dejf�d ejf�d!ejf�d"ejddgf�d#ejf�d$ejddgf�d%ejf�d&ejf�d'ejddgf�d(ejf�d)ejd*d+gf�d,ejd-gf�d.ejf�d/ejgd0d1if�d2ejgd3d4if�d5ejf�d6ejd*d7gf�d8ejf�d9ejd:d;gf�Zd<d=�Zd>d?�Z d-S)@�StringificationTestsz6Test that the exceptions have useful stringifications.z*An error occurred binding to an interface.z/An error occurred binding to an interface: foo.�fooz3An error occurred binding to an interface: foo bar.�barz"Couldn't listen on eth0:4242: Foo.�eth0i��FoozMessage is too long to send.z%Message is too long to send: foo bar.zDNS lookup failed.zDNS lookup failed: foo bar.z#An error occurred while connecting.z0An error occurred while connecting: someOsError.�someOsErrorz(An error occurred while connecting: foo.�stringz5An error occurred while connecting: someOsError: foo.zCouldn't bind.zCouldn't bind: someOsError.z Couldn't bind: someOsError: foo.zHostname couldn't be looked up.zNo route to host.z%Connection was refused by other side.zTCP connection timed out.z%File used for UNIX socket is no good.z&Service name given as port is unknown.zUser aborted connection.z'User timeout caused connection failure.zAn SSL error occurred.z=Connection to the other side was lost in a non-clean fashion.zFConnection to the other side was lost in a non-clean fashion: foo bar.zConnection was closed cleanly.z'Connection was closed cleanly: foo bar.zUh.z(Tried to cancel an already-called event.z1Tried to cancel an already-called event: foo bar.z+Tried to cancel an already-cancelled event.z0Tried to cancel an already-cancelled event: x 2.�x�2zOA process has ended without apparent errors: process finished with exit code 0.NzCA process has ended with a probable error condition: process ended.zUA process has ended with a probable error condition: process ended with exit code 42.�exitCode�*zTA process has ended with a probable error condition: process ended by signal SIGBUS.�signal�SIGBUSzFThe Connector was not connecting when it was asked to stop connecting.zLThe Connector was not connecting when it was asked to stop connecting: x 13.�13z?The Port was not listening when it was asked to stop listening.zEThe Port was not listening when it was asked to stop listening: a 12.�a�12c	Cs�|jD];}|d}|d}z|d}Wntyd}Ynwz|d}Wnty0i}Ynw|�t||i|���|�qdS)Nr����)�listOfTests�
IndexError�assertEqual�str)�self�entry�output�	exception�args�kwargsrr�9/usr/lib/python3/dist-packages/twisted/test/test_error.py�testThemAll�s
���z StringificationTests.testThemAllcCs"t�}t�|�}|�|j|�dS)zP
        L{error.ConnectingCancelledError} has an C{address} attribute.
        N)�objectr�ConnectingCancelledError�assertIs�address)rr(�errr#�test_connectingCancelledError�s
z2StringificationTests.test_connectingCancelledError)!�__name__�
__module__�__qualname__�__doc__r�	BindError�CannotListenError�socket�MessageLengthError�DNSLookupError�ConnectError�ConnectBindError�UnknownHostError�NoRouteError�ConnectionRefusedError�TCPTimedOutError�BadFileError�ServiceNameUnknownError�	UserError�TimeoutError�SSLError�ConnectionLost�ConnectionDone�ConnectionFdescWentAway�
AlreadyCalled�AlreadyCancelled�ProcessDone�ProcessTerminated�NotConnectingError�NotListeningErrorrr$r*rrrr#r
s(����
������������#��'�(�*��.�/�0�1�2�3�4�5�6�8��<��@�B��G��J�L��P�R��W��\��`��f��l��p��u��y��rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SubclassingTestsz=
    Some exceptions are subclasses of other exceptions.
    cC�|�ttjtj��dS)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionLost}.
        N)�
assertTrue�
issubclassrr?�ConnectionClosed�rrrr#�-test_connectionLostSubclassOfConnectionClosed��z>SubclassingTests.test_connectionLostSubclassOfConnectionClosedcCrI)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionDone}.
        N)rJrKrr@rLrMrrr#�-test_connectionDoneSubclassOfConnectionClosed�rOz>SubclassingTests.test_connectionDoneSubclassOfConnectionClosedcCs|�ttjt��dS)zP
        L{ValueError} is a superclass of L{error.InvalidAddressError}.
        N)rJrKr�InvalidAddressError�
ValueErrorrMrrr#�,test_invalidAddressErrorSubclassOfValueError�sz=SubclassingTests.test_invalidAddressErrorSubclassOfValueErrorN)r+r,r-r.rNrPrSrrrr#rH�s
rHc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�GetConnectErrorTestsz�
    Given an exception instance thrown by C{socket.connect},
    L{error.getConnectError} returns the appropriate high-level Twisted
    exception instance.
    cCs&|df}t�|�}|�|d||�dS)z�
        When called with a tuple with the given errno,
        L{error.getConnectError} returns an exception which is an instance of
        the expected class.
        �lalalaN)r�getConnectError�assertCorrectException)r�errno�
expectedClassr)�resultrrr#�assertErrnoException�s
z)GetConnectErrorTests.assertErrnoExceptioncCs0|�|j|�|�|j|�|�|j|f�dS)z�
        The given result of L{error.getConnectError} has the given attributes
        (C{osError} and C{args}), and is an instance of the given class.
        N)r�	__class__�osErrorr!)rrX�messagerZrYrrr#rW�sz+GetConnectErrorTests.assertCorrectExceptioncCs`|�tjtj�|�tjtj�|�tjtj�t	dkr.|�tj
tj�|�tjtj�dSdS)zW
        L{error.getConnectError} converts based on errno for C{socket.error}.
        �win32N)r[rX�ENETUNREACHrr7�ECONNREFUSEDr8�	ETIMEDOUTr9r�WSAECONNREFUSED�WSAENETUNREACHrMrrr#�
test_errno�s��zGetConnectErrorTests.test_errnocCs(t�t�dd��}|�dd|tj�dS)z
        L{error.getConnectError} converts to a L{error.UnknownHostError} given
        a C{socket.gaierror} instance.
        ��helloN)rrVr1�gaierrorrWr6)rrZrrr#�
test_gaierror�sz"GetConnectErrorTests.test_gaierrorcCs&t�}t�|�}|�d||tj�dS)z�
        L{error.getConnectError} converts to a L{error.ConnectError} given
        an argument that cannot be unpacked.
        N)�	ExceptionrrVrWr4)rr)rZrrr#�
test_nonTuple�s
z"GetConnectErrorTests.test_nonTupleN)	r+r,r-r.r[rWrerirkrrrr#rT�s

rT)rXr1�twisted.internetr�twisted.python.runtimer�
twisted.trialr�SynchronousTestCaserrHrTrrrr#�<module>s
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY