§
    Ètºfƒ9  ã                   ó¼  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZmZ ddlmZ ddlmZ  G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ dej        ¦  «        Z G d„ dej        ¦  «        Z G d„ de
j        ej        ej        ¦  «        Z G d„ dej        ej        ¦  «        Z ej        ee¦  «          ej        ee¦  «         ej                             e¦  «          G d„ dej        ¦  «        Z G d„ dej         ¦  «        Z! G d„ dej"        ¦  «        Z# G d„ de#¦  «        Z$ G d„ de$¦  «        Z% G d„ d ¦  «        Z& G d!„ d"ej"        ¦  «        Z'd#S )$z!
Tests for error handling in PB.
é    )ÚStringIO)Údefer)Úlog)Úqual)ÚflavorsÚjellyÚpb)ÚconnectedServerAndClient)Úunittestc                   ó   — e Zd ZdZdS )ÚAsynchronousExceptionzˆ
    Helper used to test remote methods which return Deferreds which fail with
    exceptions which are not L{pb.Error} subclasses.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/spread/test/test_pbfailure.pyr   r      ó   € € € € € ðð ð ð r   r   c                   ó   — e Zd ZdZdS )ÚSynchronousExceptionzm
    Helper used to test remote methods which raise exceptions which are not
    L{pb.Error} subclasses.
    Nr   r   r   r   r   r      r   r   r   c                   ó   — e Zd ZdZdS )ÚAsynchronousErrorz„
    Helper used to test remote methods which return Deferreds which fail with
    exceptions which are L{pb.Error} subclasses.
    Nr   r   r   r   r   r   "   r   r   r   c                   ó   — e Zd ZdZdS )ÚSynchronousErrorzi
    Helper used to test remote methods which raise exceptions which are
    L{pb.Error} subclasses.
    Nr   r   r   r   r   r   )   r   r   r   c                   ó   — e Zd ZdS )Ú
JellyErrorN©r   r   r   r   r   r   r   r   0   ó   € € € € € Ø€Dr   r   c                   ó   — e Zd ZdS )ÚSecurityErrorNr   r   r   r   r"   r"   4   r    r   r"   c                   óT   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zdd„Zdd„Zd
S )Ú
SimpleRootc                 óD   — t          j        t          d¦  «        ¦  «        S )zD
        Fail asynchronously with a non-pb.Error exception.
        zremote asynchronous exception)r   Úfailr   ©Úselfs    r   Úremote_asynchronousExceptionz'SimpleRoot.remote_asynchronousException?   s   € õ ŒzÕ/Ð0OÑPÔPÑQÔQÐQr   c                 ó    — t          d¦  «        ‚)zC
        Fail synchronously with a non-pb.Error exception.
        zremote synchronous exception)r   r'   s    r   Úremote_synchronousExceptionz&SimpleRoot.remote_synchronousExceptionE   s   € õ #Ð#AÑBÔBÐBr   c                 óD   — t          j        t          d¦  «        ¦  «        S )z@
        Fail asynchronously with a pb.Error exception.
        zremote asynchronous error)r   r&   r   r'   s    r   Úremote_asynchronousErrorz#SimpleRoot.remote_asynchronousErrorK   s   € õ ŒzÕ+Ð,GÑHÔHÑIÔIÐIr   c                 ó    — t          d¦  «        ‚)z?
        Fail synchronously with a pb.Error exception.
        zremote synchronous error)r   r'   s    r   Úremote_synchronousErrorz"SimpleRoot.remote_synchronousErrorQ   s   € õ Ð9Ñ:Ô:Ð:r   c                 óH   —  G d„ dt           j        ¦  «        } |d¦  «        ‚)z>
        Fail with error that is not known to client.
        c                   ó   — e Zd ZdS )ú4SimpleRoot.remote_unknownError.<locals>.UnknownErrorNr   r   r   r   ÚUnknownErrorr2   \   s   € € € € € ØˆDr   r3   zI'm not known to client!)r	   ÚError)r(   r3   s     r   Úremote_unknownErrorzSimpleRoot.remote_unknownErrorW   sA   € ð
	ð 	ð 	ð 	ð 	�2œ8ñ 	ô 	ð 	ð ˆlÐ5Ñ6Ô6Ð6r   c                 ó.   — |                       ¦   «          d S ©N)Ú
raiseJellyr'   s    r   Úremote_jellyzSimpleRoot.remote_jellya   s   € Ø�ŠÑÔÐÐÐr   c                 ó.   — |                       ¦   «          d S r7   )ÚraiseSecurityr'   s    r   Úremote_securityzSimpleRoot.remote_securityd   s   € Ø×ÒÑÔÐÐÐr   c                 óŠ   — t          j        ¦   «         }|                     | j        ¦  «         |                     d ¦  «         |S r7   )r   ÚDeferredÚaddCallbackr8   Úcallback©r(   Úds     r   Úremote_deferredJellyzSimpleRoot.remote_deferredJellyg   s:   € ÝŒNÑÔˆØ	�Š�d”oÑ&Ô&Ð&Ø	�
Š
�4ÑÔÐØˆr   c                 óŠ   — t          j        ¦   «         }|                     | j        ¦  «         |                     d ¦  «         |S r7   )r   r>   r?   r;   r@   rA   s     r   Úremote_deferredSecurityz"SimpleRoot.remote_deferredSecuritym   s;   € ÝŒNÑÔˆØ	�Š�dÔ(Ñ)Ô)Ð)Ø	�
Š
�4ÑÔÐØˆr   Nc                 ó    — t          d¦  «        ‚)NzI'm jellyable!)r   ©r(   Úresultss     r   r8   zSimpleRoot.raiseJellys   s   € ÝÐ)Ñ*Ô*Ð*r   c                 ó    — t          d¦  «        ‚)NzI'm secure!)r"   rG   s     r   r;   zSimpleRoot.raiseSecurityv   s   € Ý˜MÑ*Ô*Ð*r   r7   )r   r   r   r)   r+   r-   r/   r5   r9   r<   rC   rE   r8   r;   r   r   r   r$   r$   >   sÌ   € € € € € ðRð Rð RðCð Cð CðJð Jð Jð;ð ;ð ;ð7ð 7ð 7ðð ð ðð ð ðð ð ðð ð ð+ð +ð +ð +ð+ð +ð +ð +ð +ð +r   r$   c                   ó   — e Zd ZdZdZd„ ZdS )ÚSaveProtocolServerFactoryzd
    A L{pb.PBServerFactory} that saves the latest connected client in
    C{protocolInstance}.
    Nc                 ó   — || _         dS )z3
        Keep track of the given protocol.
        N)ÚprotocolInstance)r(   Úprotocols     r   ÚclientConnectionMadez.SaveProtocolServerFactory.clientConnectionMade‚   s   € ð !)ˆÔÐÐr   )r   r   r   r   rM   rO   r   r   r   rK   rK   z   s5   € € € € € ðð ð
 Ðð)ð )ð )ð )ð )r   rK   c                   ó   — e Zd ZdZd„ ZdS )ÚPBConnTestCaser   c                 óì   ‡ — t          t          ¦   «         ¦  «        ‰ _        ‰ j        ‰ j        _        t	          j        ¦   «         ‰ _        t          ˆ fd„ˆ fd„¦  «        \  ‰ _        ‰ _	        ‰ _
        d S )Nc                  ó8   •— ‰ j                              d ¦  «        S r7   )ÚserverFactoryÚbuildProtocolr'   s   €r   ú<lambda>z&PBConnTestCase.setUp.<locals>.<lambda>•   ó   ø€ �DÔ&×4Ò4°TÑ:Ô:€ r   c                  ó8   •— ‰ j                              d ¦  «        S r7   )ÚclientFactoryrU   r'   s   €r   rV   z&PBConnTestCase.setUp.<locals>.<lambda>–   rW   r   )rK   r$   rT   ÚunsafeTracebacksr	   ÚPBClientFactoryrY   r
   ÚconnectedServerÚconnectedClientÚpumpr'   s   `r   ÚsetUpzPBConnTestCase.setUpŒ   sw   ø€ Ý6µz±|´|ÑDÔDˆÔØ.2Ô.CˆÔÔ+ÝÔ/Ñ1Ô1ˆÔõ
 %Ø:Ð:Ð:Ð:Ø:Ð:Ð:Ð:ñ
ô 
ñ		
ØÔ ØÔ ØŒIˆIˆIr   N)r   r   r   rZ   r_   r   r   r   rQ   rQ   ‰   s)   € € € € € ØÐð
ð 
ð 
ð 
ð 
r   rQ   c                   óŽ   — e Zd Zej        j        Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd„ Zdd	„Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚPBFailureTestsc                 ó¸   ‡ ‡‡‡‡— ˆˆˆ fd„Š‰ j                              ¦   «         }ˆˆfd„}|                     |¦  «         ‰ j                             ¦   «          d S )Nc                 ó   •— |                       ‰¦  «         ‰                     | j        d¦  «         ‰r8‰                     ‰¦  «        }‰                     t          |¦  «        d¦  «         | j        | j        | j        fS )NúTraceback unavailable
é   )ÚtrapÚcompareÚ	tracebackÚflushLoggedErrorsÚassertEqualÚlenÚtypeÚvalue)ÚerrÚerrsÚexceptionTypeÚflushr(   s     €€€r   Úebz)PBFailureTests._exceptionTest.<locals>.ebž   sv   ø€ Ø�HŠH�]Ñ#Ô#Ð#Ø�LŠL˜œÐ(AÑBÔBÐBØð /Ø×-Ò-¨mÑ<Ô<�Ø× Ò ¥ T¡¤¨AÑ.Ô.Ð.Ø”H˜cœi¨¬Ð7Ð7r   c                 ó\   •— |                       ‰¦  «        }|                     ‰¦  «         |S r7   )Ú
callRemoteÚ
addErrback)ÚrootrB   rr   Úmethods     €€r   ÚgotRootObjectz4PBFailureTests._exceptionTest.<locals>.gotRootObject¨   s+   ø€ Ø—’ Ñ'Ô'ˆAØ�LŠL˜ÑÔÐØˆHr   ©rY   ÚgetRootObjectr?   r^   rq   )r(   rw   rp   rq   rB   rx   rr   s   ````  @r   Ú_exceptionTestzPBFailureTests._exceptionTest�   sŠ   øøøøø€ ð	8ð 	8ð 	8ð 	8ð 	8ð 	8ð 	8ð Ô×,Ò,Ñ.Ô.ˆð	ð 	ð 	ð 	ð 	ð 	ð
 	
�Š�mÑ$Ô$Ð$ØŒ	�ŠÑÔÐÐÐr   c                 ó:   — |                       dt          d¦  «        S )z 
        Test that a Deferred returned by a remote method which already has a
        Failure correctly has that error passed back to the calling side.
        ÚasynchronousExceptionT)r{   r   r'   s    r   Útest_asynchronousExceptionz)PBFailureTests.test_asynchronousException°   s   € ð
 ×"Ò"Ð#:Õ<QÐSWÑXÔXÐXr   c                 ó:   — |                       dt          d¦  «        S )zw
        Like L{test_asynchronousException}, but for a method which raises an
        exception synchronously.
        ÚsynchronousExceptionT)r{   r   r'   s    r   Útest_synchronousExceptionz(PBFailureTests.test_synchronousException·   s   € ð
 ×"Ò"Ð#9Õ;OÐQUÑVÔVÐVr   c                 ó:   — |                       dt          d¦  «        S )z�
        Like L{test_asynchronousException}, but for a method which returns a
        Deferred failing with an L{pb.Error} subclass.
        ÚasynchronousErrorF)r{   r   r'   s    r   Útest_asynchronousErrorz%PBFailureTests.test_asynchronousError¾   s   € ð
 ×"Ò"Ð#6Õ8IÈ5ÑQÔQÐQr   c                 ó:   — |                       dt          d¦  «        S )z}
        Like L{test_asynchronousError}, but for a method which synchronously
        raises a L{pb.Error} subclass.
        ÚsynchronousErrorF)r{   r   r'   s    r   Útest_synchronousErrorz$PBFailureTests.test_synchronousErrorÅ   s   € ð
 ×"Ò"Ð#5Õ7GÈÑOÔOÐOr   c                 ó2   — |                       ||¦  «         |S r7   )rj   )r(   ÚresultÚexpectedResults      r   Ú_successzPBFailureTests._successÌ   s   € Ø×Ò˜ Ñ0Ô0Ð0Øˆr   c                 óB   — |                      | j        ||f¬¦  «         |S )N)ÚcallbackArgs)ÚaddCallbacksr‹   )r(   Ú
remoteCallrŠ   rr   s       r   Ú_addFailingCallbacksz#PBFailureTests._addFailingCallbacksÐ   s(   € Ø×Ò ¤¨rÀÐ@QÐÑRÔRÐRØÐr   Nc                 ó°   ‡ ‡‡‡‡— ‰ j                              ¦   «         }ˆˆˆˆˆ fd„}|                     |¦  «         ‰ j                             ¦   «          dS )zÆ
        Call the given remote method and attach the given errback to the
        resulting Deferred.  If C{exc} is not None, also assert that one
        exception of that type was logged.
        c                 ó–   •— ‰                      |                      ‰¦  «        ‰‰¦  «        }‰�ˆˆfd„}|                     |¦  «         |S )Nc                 ót   •— ‰                      t          ‰                     ‰¦  «        ¦  «        d¦  «         | S )Nre   )rj   rk   ri   )rn   Úexcr(   s    €€r   Ú
gotFailurez@PBFailureTests._testImpl.<locals>.gotRootObj.<locals>.gotFailureâ   s4   ø€ Ø×$Ò$¥S¨×)?Ò)?ÀÑ)DÔ)DÑ%EÔ%EÀqÑIÔIÐIØ�Jr   )r�   rt   ÚaddBoth)ÚobjÚfailureDeferredr•   rr   r”   Úexpectedrw   r(   s      €€€€€r   Ú
gotRootObjz,PBFailureTests._testImpl.<locals>.gotRootObjÜ   sl   ø€ Ø"×7Ò7Ø—’˜vÑ&Ô&¨°"ñô ˆOð ˆðð ð ð ð ð ð  ×'Ò'¨
Ñ3Ô3Ð3Ø"Ð"r   Nry   )r(   rw   r™   rr   r”   ÚrootDeferredrš   s   `````  r   Ú	_testImplzPBFailureTests._testImplÔ   sx   øøøøø€ ð Ô)×7Ò7Ñ9Ô9ˆð	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	× Ò  Ñ,Ô,Ð,ØŒ	�ŠÑÔÐÐÐr   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )z—
        Test that an exception which is a subclass of L{pb.Error} has more
        information passed across the network to the calling side.
        c                 ó¼   •— |                       t          ¦  «         ‰                     | j        t          ¦  «         ‰                     | j        | j        ¦  «         dS )Né+   ©rf   r   ÚassertNotIsInstancerl   ÚstrÚassertIsInstancerm   ©r&   r(   s    €r   ÚfailureJellyz6PBFailureTests.test_jellyFailure.<locals>.failureJellyò   sL   ø€ Ø�IŠI•jÑ!Ô!Ð!Ø×$Ò$ T¤YµÑ4Ô4Ð4Ø×!Ò! $¤*¨d¬iÑ8Ô8Ð8Ø�2r   r   rŸ   ©rœ   )r(   r¥   s   ` r   Útest_jellyFailurez PBFailureTests.test_jellyFailureì   s4   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~˜g r¨<Ñ8Ô8Ð8r   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )z�
        Test that a Deferred which fails with a L{pb.Error} is treated in
        the same way as a synchronously raised L{pb.Error}.
        c                 ó¼   •— |                       t          ¦  «         ‰                     | j        t          ¦  «         ‰                     | j        | j        ¦  «         dS )Né®  r    r¤   s    €r   ÚfailureDeferredJellyzFPBFailureTests.test_deferredJellyFailure.<locals>.failureDeferredJelly   sL   ø€ Ø�IŠI•jÑ!Ô!Ð!Ø×$Ò$ T¤YµÑ4Ô4Ð4Ø×!Ò! $¤*¨d¬iÑ8Ô8Ð8Ø�3r   ÚdeferredJellyrª   r¦   )r(   r«   s   ` r   Útest_deferredJellyFailurez(PBFailureTests.test_deferredJellyFailureú   s5   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~˜o¨sÐ4HÑIÔIÐIr   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )z¬
        A non-jellyable L{pb.Error} subclass raised by a remote method is
        turned into a Failure with a type set to the FQPN of the exception
        type.
        c                 ó>   •— ‰                      | j        d¦  «         dS )Ns3   twisted.spread.test.test_pbfailure.SynchronousErroré¯  ©rj   rl   r¤   s    €r   ÚfailureUnjellyablezBPBFailureTests.test_unjellyableFailure.<locals>.failureUnjellyable  s*   ø€ Ø×ÒØ”	ÐQñô ð ð �3r   r†   r°   r¦   )r(   r²   s   ` r   Útest_unjellyableFailurez&PBFailureTests.test_unjellyableFailure  s6   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~Ð0°#Ð7IÑJÔJÐJr   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )z�
        Test that an exception which is a subclass of L{pb.Error} but not
        known on the client side has its type set properly.
        c                 ó>   •— ‰                      | j        d¦  «         dS )Ns/   twisted.spread.test.test_pbfailure.UnknownErroréÖ  r±   r¤   s    €r   ÚfailureUnknownz:PBFailureTests.test_unknownFailure.<locals>.failureUnknown  s*   ø€ Ø×ÒØ”	ÐMñô ð ð �4r   ÚunknownErrorr¶   r¦   )r(   r·   s   ` r   Útest_unknownFailurez"PBFailureTests.test_unknownFailure  s4   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~˜n¨d°NÑCÔCÐCr   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )zÔ
        Test that even if an exception is not explicitly jellyable (by being
        a L{pb.Jellyable} subclass), as long as it is an L{pb.Error}
        subclass it receives the same special treatment.
        c                 ó¼   •— |                       t          ¦  «         ‰                     | j        t          ¦  «         ‰                     | j        | j        ¦  «         dS )NéÌ  ©rf   r"   r¡   rl   r¢   r£   rm   r¤   s    €r   ÚfailureSecurityz<PBFailureTests.test_securityFailure.<locals>.failureSecurity,  sL   ø€ Ø�IŠI•mÑ$Ô$Ð$Ø×$Ò$ T¤YµÑ4Ô4Ð4Ø×!Ò! $¤*¨d¬iÑ8Ô8Ð8Ø�4r   Úsecurityr¼   r¦   )r(   r¾   s   ` r   Útest_securityFailurez#PBFailureTests.test_securityFailure%  s4   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~˜j¨$°Ñ@Ô@Ð@r   c                 ó<   ‡ — ˆ fd„}‰                       dd|¦  «        S )zÊ
        Test that a Deferred which fails with a L{pb.Error} which is not
        also a L{pb.Jellyable} is treated in the same way as a synchronously
        raised exception of the same type.
        c                 ó¼   •— |                       t          ¦  «         ‰                     | j        t          ¦  «         ‰                     | j        | j        ¦  «         dS )Néø§  r½   r¤   s    €r   ÚfailureDeferredSecurityzEPBFailureTests.test_deferredSecurity.<locals>.failureDeferredSecurity;  sL   ø€ Ø�IŠI•mÑ$Ô$Ð$Ø×$Ò$ T¤YµÑ4Ô4Ð4Ø×!Ò! $¤*¨d¬iÑ8Ô8Ð8Ø�5r   ÚdeferredSecurityrÃ   r¦   )r(   rÄ   s   ` r   Útest_deferredSecurityz$PBFailureTests.test_deferredSecurity4  s6   ø€ ð	ð 	ð 	ð 	ð 	ð �~Š~Ð0°%Ð9PÑQÔQÐQr   c                 óH   ‡ — ˆ fd„}‰                       dd|t          ¦  «        S )z�
        Test that attempting to call a method which is not defined correctly
        results in an AttributeError on the calling side.
        c                 ó|   •— |                       t          j        ¦  «         ‰                     | j        d¦  «         dS )Nrd   é¤  )rf   r	   ÚNoSuchMethodrg   rh   r¤   s    €r   ÚfailureNoSuchz>PBFailureTests.test_noSuchMethodFailure.<locals>.failureNoSuchI  s3   ø€ Ø�IŠI•b”oÑ&Ô&Ð&Ø�LŠL˜œÐ)BÑCÔCÐCØ�5r   ÚnosuchrÉ   )rœ   ÚAttributeError)r(   rË   s   ` r   Útest_noSuchMethodFailurez'PBFailureTests.test_noSuchMethodFailureC  s6   ø€ ð	ð 	ð 	ð 	ð 	ð
 �~Š~˜h¨¨}½nÑMÔMÐMr   c                 óÐ   ‡ — ‰ j                              ¦   «         }d„ }|                     |¦  «         ˆ fd„}|                     |¦  «         ‰ j                             ¦   «          dS )zì
        Test that a copied failure received from a PB call can be logged
        locally.

        Note: this test needs some serious help: all it really tests is that
        log.err(copiedFailure) doesn't raise an exception.
        c                 ó,   — |                       d¦  «        S )Nr€   )rt   )ÚrootObjs    r   Ú	connectedz;PBFailureTests.test_copiedFailureLogging.<locals>.connectedZ  s   € Ø×%Ò%Ð&<Ñ=Ô=Ð=r   c                 óª   •— t          j        | ¦  «         ‰                     t          ¦  «        }‰                     t          |¦  «        d¦  «         d S )Né   )r   rn   ri   r   rj   rk   )Úfailurero   r(   s     €r   Ú	exceptionz;PBFailureTests.test_copiedFailureLogging.<locals>.exception_  sI   ø€ ÝŒG�GÑÔÐØ×)Ò)Õ*>Ñ?Ô?ˆDØ×Ò�S ™YœY¨Ñ*Ô*Ð*Ð*Ð*r   N)rY   rz   r?   ru   r^   rq   )r(   rB   rÒ   rÖ   s   `   r   Útest_copiedFailureLoggingz(PBFailureTests.test_copiedFailureLoggingP  s�   ø€ ð Ô×,Ò,Ñ.Ô.ˆð	>ð 	>ð 	>ð 	
�Š�iÑ Ô Ð ð	+ð 	+ð 	+ð 	+ð 	+ð
 	
�Š�YÑÔÐØŒ	�ŠÑÔÐÐÐr   c                 ó†  ‡ ‡— t          j        t          d¦  «        ¦  «        }t          j        t          j        |t          ¦   «         ¬¦  «        ¦  «        }g Šˆˆ fd„} |¦   «         }|                     d¦  «         ‰                      t          |j	        |¦  «         ‰  
                    t          ‰¦  «        d¦  «         ‰d         }‰  
                    |j        t          t          ¦  «                             d¦  «        ¦  «         ‰  
                    |j        d¦  «         ‰  
                    |j        d	¦  «         dS )
z±
        L{pb.CopiedFailure.throwExceptionIntoGenerator} will throw a
        L{RemoteError} into the given paused generator at the point where it
        last yielded.
        Úfoo©Úinvokerc               3   ó¤   •K  — 	 d V — ‰                      d¦  «         d S # t          j        $ r } ‰                     | ¦  «         Y d } ~ d S d } ~ ww xY w)NzRemoteError not raised)r&   r	   ÚRemoteErrorÚappend)r”   rÖ   r(   s    €€r   ÚgeneratorFunczFPBFailureTests.test_throwExceptionIntoGenerator.<locals>.generatorFuncq  sy   øè è € ð4Ø�
�
�
ð —	’	Ð2Ñ3Ô3Ð3Ð3Ð3øõ ”>ð &ð &ð &Ø× Ò  Ñ%Ô%Ð%Ð%Ð%Ð%Ð%Ð%Ð%øøøøð&øøøs   …   A¯A
Á
ANre   r   Úascii)rÙ   rd   )r	   ÚCopyableFailurerÍ   r   ÚunjellyÚDummyInvokerÚsendÚassertRaisesÚStopIterationÚthrowExceptionIntoGeneratorrj   rk   Ú
remoteTyper   ÚencodeÚargsÚremoteTraceback)r(   ÚoriginalÚcopyrß   Úgenr”   rÖ   s   `     @r   Ú test_throwExceptionIntoGeneratorz/PBFailureTests.test_throwExceptionIntoGeneratorg  s%  øø€ õ Ô%¥n°UÑ&;Ô&;Ñ<Ô<ˆÝŒ}�Uœ[¨½<¹>¼>ÐJÑJÔJÑKÔKˆØˆ	ð	4ð 	4ð 	4ð 	4ð 	4ð 	4ð ˆm‰oŒoˆØ�Š�‰ŒˆØ×Ò�-¨Ô)IÈ3ÑOÔOÐOØ×Ò�˜Y™œ¨Ñ+Ô+Ð+Ø˜ŒlˆØ×Ò˜œ­­nÑ)=Ô)=×)DÒ)DÀWÑ)MÔ)MÑNÔNÐNØ×Ò˜œ 8Ñ,Ô,Ð,Ø×Ò˜Ô,Ð.GÑHÔHÐHÐHÐHr   r7   )r   r   r   r   ÚTestCaserj   rg   r{   r~   r�   r„   r‡   r‹   r�   rœ   r§   r­   r³   r¹   rÀ   rÆ   rÎ   r×   rï   r   r   r   ra   ra   š   sF  € € € € € ØÔÔ+€Gðð ð ð&Yð Yð YðWð Wð WðRð Rð RðPð Pð Pðð ð ðð ð ðð ð ð ð09ð 9ð 9ðJð Jð JðKð Kð KðDð Dð DðAð Að AðRð Rð RðNð Nð Nðð ð ð.Ið Ið Ið Ið Ir   ra   c                   ó*   — e Zd Zej        j        ZdZdS )ÚPBFailureUnsafeTestsre   N)r   r   r   r   rð   ÚfailIfEqualsrg   rZ   r   r   r   rò   rò   ƒ  s!   € € € € € ØÔÔ,€GØÐÐÐr   rò   c                   ó   — e Zd ZdZdZdS )rã   zZ
    A behaviorless object to be used as the invoker parameter to
    L{jelly.jelly}.
    N)r   r   r   r   ÚserializingPerspectiver   r   r   rã   rã   ˆ  s"   € € € € € ðð ð
 "ÐÐÐr   rã   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚFailureJellyingTestsz:
    Tests for the interaction of jelly and failures.
    c                 óF  — t          j        t          ¦   «         ¦  «        }|                      |                     t          ¦  «        t          ¦  «         |                      |                     t
          ¦  «        t
          ¦  «         t          j        t          j        |t          ¦   «         ¬¦  «        ¦  «        }|                      |                     t          ¦  «        t          ¦  «         |                      |                     t
          ¦  «        t
          ¦  «         dS )zš
        An unjellied L{CopyableFailure} has a check method which behaves the
        same way as the original L{CopyableFailure}'s check method.
        rÚ   N©	r	   rá   ÚZeroDivisionErrorÚassertIsÚcheckÚArithmeticErrorr   râ   rã   )r(   rì   Úcopieds      r   Útest_unjelliedFailureCheckz/FailureJellyingTests.test_unjelliedFailureCheck–  sÇ   € õ
 Ô%Õ&7Ñ&9Ô&9Ñ:Ô:ˆØ�Š�h—n’nÕ%6Ñ7Ô7Õ9JÑKÔKÐKØ�Š�h—n’n¥_Ñ5Ô5µÑGÔGÐGÝ”�uœ{¨8½\¹^¼^ÐLÑLÔLÑMÔMˆØ�Š�f—l’lÕ#4Ñ5Ô5Õ7HÑIÔIÐIØ�Š�f—l’l¥?Ñ3Ô3µ_ÑEÔEÐEÐEÐEr   c                 óÖ  — t          j        t          ¦   «         ¦  «        }|                      |                     t          ¦  «        t          ¦  «         |                      |                     t
          ¦  «        t
          ¦  «         t          j        t          j        |t          ¦   «         ¬¦  «        ¦  «        }t          j        |¦  «        }t          j        t          j        |t          ¦   «         ¬¦  «        ¦  «        }|                      |                     t          ¦  «        t          ¦  «         |                      |                     t
          ¦  «        t
          ¦  «         dS )aX  
        The object which results from jellying a L{CopyableFailure}, unjellying
        the result, creating a new L{CopyableFailure} from the result of that,
        jellying it, and finally unjellying the result of that has a check
        method which behaves the same way as the original L{CopyableFailure}'s
        check method.
        rÚ   Nrù   )r(   rì   Ú
copiedOnceÚ
derivativeÚcopiedTwices        r   Útest_twiceUnjelliedFailureCheckz4FailureJellyingTests.test_twiceUnjelliedFailureCheck¢  sý   € õ Ô%Õ&7Ñ&9Ô&9Ñ:Ô:ˆØ�Š�h—n’nÕ%6Ñ7Ô7Õ9JÑKÔKÐKØ�Š�h—n’n¥_Ñ5Ô5µÑGÔGÐGÝ”]¥5¤;¨xÅÁÄÐ#PÑ#PÔ#PÑQÔQˆ
ÝÔ'¨
Ñ3Ô3ˆ
Ý”m¥E¤K°
ÅLÁNÄNÐ$SÑ$SÔ$SÑTÔTˆØ�Š�k×'Ò'Õ(9Ñ:Ô:Õ<MÑNÔNÐNØ�Š�k×'Ò'­Ñ8Ô8½/ÑJÔJÐJÐJÐJr   c                 ó˜  — t          j        t          d¦  «        ¦  «        }t          j        t          j        |t          ¦   «         ¬¦  «        ¦  «        }t          ¦   «         }|                     |¦  «         t          t          ¦  «        }d 	                    |¦  «        }|  
                    ||                     ¦   «         ¦  «         dS )a  
        When L{CopiedFailure.printTraceback} is used to print a copied failure
        which was unjellied from a L{CopyableFailure} with C{unsafeTracebacks}
        set to C{False}, the string representation of the exception value is
        included in the output.
        zsome reasonrÚ   z.Traceback from remote host -- {}: some reason
N)r	   rá   Ú	Exceptionr   râ   rã   r   ÚprintTracebackr   Úformatrj   Úgetvalue)r(   rì   rþ   ÚoutputrÖ   ÚexpectedOutputs         r   Ú test_printTracebackIncludesValuez5FailureJellyingTests.test_printTracebackIncludesValue³  s¦   € õ Ô%¥i°Ñ&>Ô&>Ñ?Ô?ˆÝ”�uœ{¨8½\¹^¼^ÐLÑLÔLÑMÔMˆÝ‘”ˆØ×Ò˜fÑ%Ô%Ð%Ý�‘O”Oˆ	ØM×TÒTØñ
ô 
ˆð 	×Ò˜¨¯ªÑ):Ô):Ñ;Ô;Ð;Ð;Ð;r   N)r   r   r   r   rÿ   r  r  r   r   r   r÷   r÷   ‘  sQ   € € € € € ðð ð
Fð 
Fð 
FðKð Kð Kð"<ð <ð <ð <ð <r   r÷   N)(r   Úior   Útwisted.internetr   Útwisted.pythonr   Útwisted.python.reflectr   Útwisted.spreadr   r   r	   Útwisted.test.iosimr
   Útwisted.trialr   r  r   r   r4   r   r   Ú	JellyableÚ
RemoteCopyr   r"   ÚsetUnjellyableForClassÚglobalSecurityÚallowInstancesOfÚRootr$   ÚPBServerFactoryrK   rð   rQ   ra   rò   rã   r÷   r   r   r   ú<module>r     s:  ððð ð Ð Ð Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø "Ð "Ð "Ð "Ð "Ð "ð
ð ð ð ð ˜Iñ ô ð ðð ð ð ð ˜9ñ ô ð ðð ð ð ð ˜œñ ô ð ðð ð ð ð �r”xñ ô ð ð	ð 	ð 	ð 	ð 	�Ô" B¤H¨b¬mñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�B”H˜bœmñ 	ô 	ð 	ð €Ô ˜* jÑ 1Ô 1Ð 1Ø €Ô ˜-¨Ñ 7Ô 7Ð 7Ø Ô × "Ò " =Ñ 1Ô 1Ð 1ð9+ð 9+ð 9+ð 9+ð 9+�”ñ 9+ô 9+ð 9+ðx)ð )ð )ð )ð ) Ô 2ñ )ô )ð )ð
ð 
ð 
ð 
ð 
�XÔ&ñ 
ô 
ð 
ð"fIð fIð fIð fIð fI�^ñ fIô fIð fIðRð ð ð ð ˜>ñ ô ð ð
"ð "ð "ð "ð "ñ "ô "ð "ð1<ð 1<ð 1<ð 1<ð 1<˜8Ô,ñ 1<ô 1<ð 1<ð 1<ð 1<r   