Ë
    ojk&  ã                  óÊ   — d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
  G d„ de
j                  «      Z G d„ d	e
j                  «      Z G d
„ de
j                  «      Zy)é    )ÚannotationsN)ÚSequence)Úerror)Úunittestc                  ó¶  — e Zd ZU dZg dej
                  g i f‘dej
                  dgi f‘dej
                  ddgi f‘dej                  dd	 ej                  d
«      fi f‘dej                  g i f‘dej                  ddgi f‘dej                  g i f‘dej                  ddgi f‘dej                  g i f‘dej                  dgi f‘dej                  g ddif‘dej                  ddgi f‘dej                  g i f‘dej                  dgi f‘dej                  ddgi f‘dej                  g i f‘dej                  g i f‘dej                  g i f‘dej                  g i f‘dej                   g i f‘dej"                  g i f‘dej$                  g i f‘dej&                  g i f‘d ej(                  g i f‘d!ej*                  g i f‘d"ej*                  ddgi f‘d#ej,                  g i f‘d$ej,                  ddgi f‘d%ej.                  g i f‘d&ej0                  g i f‘d'ej0                  ddgi f‘d(ej2                  g i f‘d)ej2                  d*d+gi f‘d,ej4                  d-gi f‘d.ej6                  g i f‘d/ej6                  g d0d1if‘d2ej6                  g d3d4if‘d5ej8                  g i f‘d6ej8                  d*d7gi f‘d8ej:                  g i f‘d9ej:                  d:d;gi f‘Zd<ed=<   d@d>„Z d@d?„Z!y-)AÚ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’  ÚFoozMessage is too long to send.z%Message is too long to send: foo bar.zDNS lookup failed.zDNS 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.zCouldn't bind.zCouldn't bind: someOsError.z Couldn't bind: someOsError: foo.zHostname couldn't be looked up.zNo route to host.z%Connection was refused by other side.zTCP connection timed out.z%File used for UNIX socket is no good.z&Service name given as port is unknown.zUser aborted connection.z'User timeout caused connection failure.zAn 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.zConnection was closed cleanly.z'Connection was closed cleanly: foo bar.zUh.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Ú12z_list[tuple[str, type[Exception], Sequence[str | int | Exception | None], dict[str, str | int]]]ÚlistOfTestsc           
     ó�   — | j                   D ]7  }|d   }|d   }|d   }|d   }| j                  t         ||i |¤Ž«      |«       Œ9 y )Nr   é   é   é   )r   ÚassertEqualÚstr)ÚselfÚentryÚoutputÚ	exceptionÚargsÚkwargss         ú9/usr/lib/python3/dist-packages/twisted/test/test_error.pyÚtestThemAllz StringificationTests.testThemAll¸   s\   € Ø×%Ñ%ò 	FˆEØ˜1‘XˆFØ˜a™ˆIØ˜‘8ˆDØ˜1‘XˆFà×ÑœS¡¨DÐ!;°FÑ!;Ó<¸fÕEñ	Fó    c                óz   — t        «       }t        j                  |«      }| j                  |j                  |«       y)zP
        L{error.ConnectingCancelledError} has an C{address} attribute.
        N)Úobjectr   ÚConnectingCancelledErrorÚassertIsÚaddress)r   r,   Úes      r%   Útest_connectingCancelledErrorz2StringificationTests.test_connectingCancelledErrorÁ   s-   € ô “(ˆÜ×*Ñ*¨7Ó3ˆØ�‰�a—i‘i Õ)r'   ©ÚreturnÚNone)"Ú__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ÚNotListeningErrorr   Ú__annotations__r&   r.   © r'   r%   r   r      s`  … Ù@ð^	à	5°u·±ÈÈBÐOð^	ð >Ø�O‰OØˆGØð		
ð^	ð BØ�O‰OØ�EˆNØð		
ð^	ð  1Ø×#Ñ#Ø�T˜<˜6Ÿ<™<¨Ó.Ð/Øð		
ð^	ð* 
(¨×)AÑ)AÀ2ÀrÐJð+^	ð. 4Ø×$Ñ$Ø�EˆNØð		
ð-^	ð8 
˜u×3Ñ3°R¸Ð<ð9^	ð: 
'¨×(<Ñ(<¸uÀe¸nÈbÐQð;^	ð< 
/°×0BÑ0BÀBÈÐKð=^	ð@ ?Ø×ÑØˆOØð		
ð?^	ðL 7Ø×ÑØØ�uÐð		
ðK^	ðX DØ×ÑØ˜EÐ"Øð		
ðW^	ðb 
˜5×1Ñ1°2°rÐ:ðc^	ðd 
'¨×(>Ñ(>ÀÀÐQSÐTðe^	ðh /Ø×"Ñ"Ø˜EÐ"Øð		
ðg^	ðr 
+¨E×,BÑ,BÀBÈÐKðs^	ðt 
˜e×0Ñ0°"°bÐ9ðu^	ðv 
1°%×2NÑ2NÐPRÐTVÐWðw^	ðx 
% e×&<Ñ&<¸bÀ"ÐEðy^	ðz 
1°%×2DÑ2DÀbÈ"ÐMð{^	ð~ 5Ø×)Ñ)ØØð		
ð}^	ðH 
$ U§_¡_°b¸"Ð=ðI^	ðJ 
3°E×4FÑ4FÈÈBÐOðK^	ðL 
" 5§>¡>°2°rÐ:ðM^	ðP LØ× Ñ ØØð		
ðO^	ð\ UØ× Ñ Ø�EˆNØð		
ð[^	ðf 
*¨5×+?Ñ+?ÀÀRÐHðg^	ðj 6Ø× Ñ Ø�EˆNØð		
ði^	ðv Ø×)Ñ)ØØð		
ðu^	ð@ 
4°U×5HÑ5HÈ"ÈbÐQðA^	ðD @Ø×ÑØ�EˆNØð		
ðC^	ðN 
7¸×8NÑ8NÐPRÐTVÐWðO^	ðR ?Ø×"Ñ"Ø�#ˆJØð		
ðQ^	ð^ ^Ø×ÑØˆFØð		
ð]^	ðj RØ×#Ñ#ØØð		
ði^	ðv dØ×#Ñ#ØØ˜Ðð		
ðu^	ðB cØ×#Ñ#ØØ�xÐ ð		
ðA^	ðN UØ×$Ñ$ØØð		
ðM^	ðZ [Ø×$Ñ$Ø�$ˆKØð		
ðY^	ðf NØ×#Ñ#ØØð		
ðe^	ðr TØ×#Ñ#Ø�$ˆKØð		
ðq^	ð ð ó eóNFô*r'   r   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)ÚSubclassingTestsz=
    Some exceptions are subclasses of other exceptions.
    c                ór   — | j                  t        t        j                  t        j                  «      «       y)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionLost}.
        N)Ú
assertTrueÚ
issubclassr   rF   ÚConnectionClosed©r   s    r%   Ú-test_connectionLostSubclassOfConnectionClosedz>SubclassingTests.test_connectionLostSubclassOfConnectionClosedÏ   ó#   € ð 	�‰œ
¤5×#7Ñ#7¼×9OÑ9OÓPÕQr'   c                ór   — | j                  t        t        j                  t        j                  «      «       y)zW
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionDone}.
        N)rT   rU   r   rG   rV   rW   s    r%   Ú-test_connectionDoneSubclassOfConnectionClosedz>SubclassingTests.test_connectionDoneSubclassOfConnectionClosedÕ   rY   r'   c                ó^   — | j                  t        t        j                  t        «      «       y)zP
        L{ValueError} is a superclass of L{error.InvalidAddressError}.
        N)rT   rU   r   ÚInvalidAddressErrorÚ
ValueErrorrW   s    r%   Ú,test_invalidAddressErrorSubclassOfValueErrorz=SubclassingTests.test_invalidAddressErrorSubclassOfValueErrorÛ   s   € ð 	�‰œ
¤5×#<Ñ#<¼jÓIÕJr'   Nr/   )r2   r3   r4   r5   rX   r[   r_   rP   r'   r%   rR   rR   Ê   s   „ ñóRóRôKr'   rR   c                  óX   — e Zd ZdZ	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 d	d„Zd
d„Zd
d„Zd
d„Zy)ÚGetConnectErrorTestsz¢
    Given an exception instance thrown by C{socket.connect},
    L{error.getConnectError} returns the appropriate high-level Twisted
    exception instance.
    c                ó^   — |df}t        j                  |«      }| j                  |d||«       y)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-   Úresults        r%   ÚassertErrnoExceptionz)GetConnectErrorTests.assertErrnoExceptioné   s2   € ð �HÐˆÜ×&Ñ& qÓ)ˆØ×#Ñ# E¨8°V¸]ÕKr'   c                ó®   — | j                  |j                  |«       | j                  |j                  |«       | j                  |j                  |f«       y)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#   )r   rf   Úmessagerh   rg   s        r%   re   z+GetConnectErrorTests.assertCorrectExceptionõ   sD   € ð 	×Ñ˜×)Ñ)¨=Ô9Ø×Ñ˜Ÿ™¨Ô/Ø×Ñ˜Ÿ™ w jÕ1r'   c                óø  — | j                  t        j                  t        j                  «       | j                  t        j
                  t        j                  «       | j                  t        j                  t        j                  «       t        j                  dk(  r]| j                  t        j                  t        j                  «       | j                  t        j                  t        j                  «       yy)zW
        L{error.getConnectError} converts based on errno for C{socket.error}.
        Úwin32N)ri   rf   ÚENETUNREACHr   r>   ÚECONNREFUSEDr?   Ú	ETIMEDOUTr@   ÚsysÚplatformÚWSAECONNREFUSEDÚWSAENETUNREACHrW   s    r%   Ú
test_errnozGetConnectErrorTests.test_errno  s¤   € ð 	×!Ñ!¤%×"3Ñ"3´U×5GÑ5GÔHØ×!Ñ!¤%×"4Ñ"4´e×6RÑ6RÔSØ×!Ñ!¤%§/¡/´5×3IÑ3IÔJÜ�<‰<˜7Ò"Ø×%Ñ%Ü×%Ñ%¤u×'CÑ'Côð ×%Ñ%¤e×&:Ñ&:¼E×<NÑ<NÕOð	 #r'   c                óš   — t        j                  t        j                  dd«      «      }| j	                  dd|t         j
                  «       y)z
        L{error.getConnectError} converts to a L{error.UnknownHostError} given
        a C{socket.gaierror} instance.
        é   ÚhelloN)r   rd   r8   Úgaierrorre   r=   )r   rh   s     r%   Útest_gaierrorz"GetConnectErrorTests.test_gaierror  s9   € ô
 ×&Ñ&¤v§¡°r¸7Ó'CÓDˆØ×#Ñ# B¨°¼×9OÑ9OÕPr'   c                ó†   — t        «       }t        j                  |«      }| j                  d||t        j                  «       y)z�
        L{error.getConnectError} converts to a L{error.ConnectError} given
        an argument that cannot be unpacked.
        N)Ú	Exceptionr   rd   re   r;   )r   r-   rh   s      r%   Útest_nonTuplez"GetConnectErrorTests.test_nonTuple  s5   € ô
 ‹KˆÜ×&Ñ& qÓ)ˆØ×#Ñ# D¨!¨V´U×5GÑ5GÕHr'   N)rf   Úintrg   útype[error.ConnectError]r0   r1   )
rf   z
int | Nonerm   r)   rh   zerror.ConnectErrorrg   r�   r0   r1   r/   )	r2   r3   r4   r5   ri   re   rw   r|   r   rP   r'   r%   ra   ra   â   so   „ ñð
LØð
LØ)Að
Là	ó
Lð2àð2ð ð2ð #ð	2ð
 0ð2ð 
ó2ó"PóQôIr'   ra   )Ú
__future__r   rf   r8   rs   Útypingr   Útwisted.internetr   Útwisted.trialr   ÚSynchronousTestCaser   rR   ra   rP   r'   r%   ú<module>r‡      s[   ðõ #ã Û Û 
Ý å "Ý "ôy*˜8×7Ñ7ô y*ôxK�x×3Ñ3ô Kô0@I˜8×7Ñ7õ @Ir'   