HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/twisted/test/__pycache__/test_error.cpython-38.pyc
U


W[�!�@s~ddlmZmZddlZddlZddlmZddlmZddl	m
Z
Gdd�dej�ZGdd	�d	ej�Z
Gd
d�dej�ZdS)�)�division�absolute_importN)�unittest)�error)�platformTypec,@s�eZdZdZdejfdejdgfdejddgfdejdd	e�d
�ffdejfdejddgfd
ej	fdej	ddgfdej
fdej
dgfdej
gddifdej
ddgfdejfdejdgfdejddgfdejfdej
fdejfdejfdejfdejfdejfdejfd ejfd!ejfd"ejddgfd#ejfd$ejddgfd%ejfd&ejfd'ejddgfd(ejfd)ejd*d+gfd,ejd-gfd.ejfd/ejgd0d1ifd2ejgd3d4ifd5ejfd6ejd*d7gfd8ejfd9ejd:d;gfg)Zd<d=�Zd>d?�Z d-S)@�StringificationTestsz;Test that the exceptions have useful stringifications.
    z*An error occurred binding to an interface.z/An error occurred binding to an interface: foo.Zfooz3An error occurred binding to an interface: foo bar.Zbarz"Couldn't listen on eth0:4242: Foo.Zeth0i�ZFoozMessage 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.ZsomeOsErrorz(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.ZexitCode�*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.Z13z?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.�aZ12c	Cs�|jD]v}|d}|d}z|d}Wntk
r>d}YnXz|d}Wntk
rdi}YnX|�t|||��|�qdS)Nr����)�listOfTests�
IndexError�assertEqual�str)�self�entry�outputZ	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)�objectrZConnectingCancelledErrorZassertIs�address)rr�errr�test_connectingCancelledError�s
z2StringificationTests.test_connectingCancelledError)!�__name__�
__module__�__qualname__�__doc__rZ	BindErrorZCannotListenError�socketZMessageLengthErrorZDNSLookupError�ConnectErrorZConnectBindError�UnknownHostError�NoRouteError�ConnectionRefusedError�TCPTimedOutErrorZBadFileErrorZServiceNameUnknownErrorZ	UserError�TimeoutErrorZSSLError�ConnectionLost�ConnectionDoneZConnectionFdescWentAwayZ
AlreadyCalledZAlreadyCancelledZProcessDoneZProcessTerminatedZNotConnectingErrorZNotListeningErrorrrr!rrrrrs.�������������������������������������������rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SubclassingTestsz=
    Some exceptions are subclasses of other exceptions.
    cCs|�ttjtj��dS)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionLost}.
        N)�
assertTrue�
issubclassrr-�ConnectionClosed�rrrr�-test_connectionLostSubclassOfConnectionClosed�s
�z>SubclassingTests.test_connectionLostSubclassOfConnectionClosedcCs|�ttjtj��dS)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionDone}.
        N)r0r1rr.r2r3rrr�-test_connectionDoneSubclassOfConnectionClosed�s
�z>SubclassingTests.test_connectionDoneSubclassOfConnectionClosedcCs|�ttjt��dS)zP
        L{ValueError} is a superclass of L{error.InvalidAddressError}.
        N)r0r1rZInvalidAddressError�
ValueErrorr3rrr�,test_invalidAddressErrorSubclassOfValueError�s
�z=SubclassingTests.test_invalidAddressErrorSubclassOfValueErrorN)r"r#r$r%r4r5r7rrrrr/�sr/c@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.
        ZlalalaN)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__ZosErrorr)rr;�messager=r<rrrr:�sz+GetConnectErrorTests.assertCorrectExceptioncCs\|�tjtj�|�tjtj�|�tjtj�t	dkrX|�tj
tj�|�tjtj�dS)zW
        L{error.getConnectError} converts based on errno for C{socket.error}.
        Zwin32N)r>r;ZENETUNREACHrr)ZECONNREFUSEDr*Z	ETIMEDOUTr+rZWSAECONNREFUSEDZWSAENETUNREACHr3rrr�
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.
        �ZhelloN)rr9r&Zgaierrorr:r()rr=rrr�
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)�	Exceptionrr9r:r')rr r=rrr�
test_nonTuples
z"GetConnectErrorTests.test_nonTupleN)	r"r#r$r%r>r:rArCrErrrrr8�s	r8)Z
__future__rrr&r;Z
twisted.trialrZtwisted.internetrZtwisted.python.runtimerZSynchronousTestCaserr/r8rrrr�<module>s&