Ë
    ojƒ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j0                  «      Z G d„ dej(                  ej0                  «      Z ej6                  ee«        ej6                  ee«       ej8                  j;                  e«        G d„ dej<                  «      Z G d„ dej@                  «      Z! G d„ dejD                  «      Z# G d„ de#«      Z$ G d„ de$«      Z% G d„ d «      Z& G d!„ d"ejD                  «      Z'y#)$z!
Tests for error handling in PB.
é    )ÚStringIO)Údefer)Úlog)Úqual)ÚflavorsÚjellyÚpb)ÚconnectedServerAndClient)Úunittestc                   ó   — e Zd ZdZy)Ú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__© ó    úD/usr/lib/python3/dist-packages/twisted/spread/test/test_pbfailure.pyr   r      ó   „ òr   r   c                   ó   — e Zd ZdZy)Ú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y)Ú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y)Ú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y)Ú
JellyErrorN©r   r   r   r   r   r   r   r   0   ó   „ Ør   r   c                   ó   — e Zd Zy)ÚSecurityErrorNr   r   r   r   r"   r"   4   r    r   r"   c                   óR   — 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y
)Ú
SimpleRootc                 ó>   — 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‰zÔ/Ð0OÓPÓ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ÐBr   c                 ó>   — 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‰zÔ+Ð,GÓHÓ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                 óD   —  G d„ dt         j                  «      } |d«      ‚)z>
        Fail with error that is not known to client.
        c                   ó   — e Zd Zy)ú4SimpleRoot.remote_unknownError.<locals>.UnknownErrorNr   r   r   r   ÚUnknownErrorr2   \   s   „ Ør   r3   zI'm not known to client!)r	   ÚError)r(   r3   s     r   Úremote_unknownErrorzSimpleRoot.remote_unknownErrorW   s    € ô
	œ2Ÿ8™8ô 	ñ Ð5Ó6Ð6r   c                 ó$   — | j                  «        y ©N)Ú
raiseJellyr'   s    r   Úremote_jellyzSimpleRoot.remote_jellya   s   € Ø�‰Õr   c                 ó$   — | j                  «        y r7   )ÚraiseSecurityr'   s    r   Úremote_securityzSimpleRoot.remote_securityd   s   € Ø×ÑÕr   c                 ó†   — t        j                  «       }|j                  | j                  «       |j	                  d «       |S r7   )r   ÚDeferredÚaddCallbackr8   Úcallback©r(   Úds     r   Úremote_deferredJellyzSimpleRoot.remote_deferredJellyg   s/   € Ü�N‰NÓˆØ	�‰�d—o‘oÔ&Ø	�
‰
�4ÔØˆr   c                 ó†   — t        j                  «       }|j                  | j                  «       |j	                  d «       |S r7   )r   r>   r?   r;   r@   rA   s     r   Úremote_deferredSecurityz"SimpleRoot.remote_deferredSecuritym   s1   € Ü�N‰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òCòJò;ò7òòòòó+ô+r   r$   c                   ó   — e Zd ZdZdZd„ Zy)ÚSaveProtocolServerFactoryzd
    A L{pb.PBServerFactory} that saves the latest connected client in
    C{protocolInstance}.
    Nc                 ó   — || _         y)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   s   „ ñð
 Ðó)r   rK   c                   ó   — e Zd ZdZd„ Zy)ÚPBConnTestCaser   c                 óè   ‡ — t        t        «       «      ‰ _        ‰ j                  ‰ j                  _        t	        j
                  «       ‰ _        t        ˆ fd„ˆ fd„«      \  ‰ _        ‰ _	        ‰ _
        y )Nc                  ó:   •— ‰ j                   j                  d «      S r7   )ÚserverFactoryÚbuildProtocolr'   s   €r   ú<lambda>z&PBConnTestCase.setUp.<locals>.<lambda>•   ó   ø€ �D×&Ñ&×4Ñ4°TÓ:€ r   c                  ó:   •— ‰ j                   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Œ   s]   ø€ Ü6´z³|ÓDˆÔØ.2×.CÑ.Cˆ×ÑÔ+Ü×/Ñ/Ó1ˆÔô
 %Û:Û:ó
ñ		
ØÔ ØÔ Ø�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y)ÚPBFailureTestsc                 ó²   ‡ ‡‡‡‡— ˆˆˆ fd„Š‰ j                   j                  «       }ˆˆfd„}|j                  |«       ‰ j                  j	                  «        y )Nc                 ó   •— | j                  ‰«       ‰j                  | j                  d«       ‰r,‰j                  ‰«      }‰j	                  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ž   sb   ø€ Ø�H‰H�]Ô#Ø�L‰L˜Ÿ™Ð(AÔBÙØ×-Ñ-¨mÓ<�Ø× Ñ ¤ T£¨AÔ.Ø—H‘H˜cŸi™i¨¯©Ð7Ð7r   c                 óL   •— | j                  ‰«      }|j                  ‰«       |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ð ×Ñ×,Ñ,Ó.ˆõ	ð
 	
�‰�mÔ$Ø�	‰	�‰Õr   c                 ó0   — | j                  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ÐXr   c                 ó0   — | j                  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ÐVr   c                 ó0   — | j                  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ÐQr   c                 ó0   — | j                  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ÐOr   c                 ó*   — | j                  ||«       |S r7   )rj   )r(   ÚresultÚexpectedResults      r   Ú_successzPBFailureTests._successÌ   s   € Ø×Ñ˜ Ô0Øˆr   c                 óD   — |j                  | j                  ||f¬«       |S )N)ÚcallbackArgs)ÚaddCallbacksr‹   )r(   Ú
remoteCallrŠ   rr   s       r   Ú_addFailingCallbacksz#PBFailureTests._addFailingCallbacksÐ   s$   € Ø×Ñ §¡¨rÀÐ@QÐÔRØÐr   Nc                 óª   ‡ ‡‡‡‡— ‰ j                   j                  «       }ˆˆˆˆˆ fd„}|j                  |«       ‰ j                  j	                  «        y)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                 ó~   •— ‰j                  | j                  ‰«      ‰‰«      }‰�ˆˆfd„}|j                  |«       |S )Nc                 ó\   •— ‰j                  t        ‰j                  ‰«      «      d«       | S )Nre   )rj   rk   ri   )rn   Úexcr(   s    €€r   Ú
gotFailurez@PBFailureTests._testImpl.<locals>.gotRootObj.<locals>.gotFailureâ   s(   ø€ Ø×$Ñ$¤S¨×)?Ñ)?ÀÓ)DÓ%EÀqÔIØ�Jr   )r�   rt   ÚaddBoth)ÚobjÚfailureDeferredr•   rr   r”   Úexpectedrw   r(   s      €€€€€r   Ú
gotRootObjz,PBFailureTests._testImpl.<locals>.gotRootObjÜ   sE   ø€ Ø"×7Ñ7Ø—‘˜vÓ&¨°"óˆOð ˆõð  ×'Ñ'¨
Ô3Ø"Ð"r   Nry   )r(   rw   r™   rr   r”   ÚrootDeferredrš   s   `````  r   Ú	_testImplzPBFailureTests._testImplÔ   sA   ü€ ð ×)Ñ)×7Ñ7Ó9ˆ÷	#ð 	#ð 	× Ñ  Ô,Ø�	‰	�‰Õr   c                 ó4   ‡ — ˆ fd„}‰ j                  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                 ó¼   •— | j                  t        «       ‰j                  | j                  t        «       ‰j                  | j                  | j                  «       y)Né+   ©rf   r   ÚassertNotIsInstancerl   ÚstrÚassertIsInstancerm   ©r&   r(   s    €r   ÚfailureJellyz6PBFailureTests.test_jellyFailure.<locals>.failureJellyò   s>   ø€ Ø�I‰I”jÔ!Ø×$Ñ$ T§Y¡Y´Ô4Ø×!Ñ! $§*¡*¨d¯i©iÔ8Ør   r   rŸ   ©rœ   )r(   r¥   s   ` r   Útest_jellyFailurez PBFailureTests.test_jellyFailureì   s   ø€ ô	ð �~‰~˜g r¨<Ó8Ð8r   c                 ó4   ‡ — ˆ fd„}‰ j                  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                 ó¼   •— | j                  t        «       ‰j                  | j                  t        «       ‰j                  | j                  | j                  «       y)Né®  r    r¤   s    €r   ÚfailureDeferredJellyzFPBFailureTests.test_deferredJellyFailure.<locals>.failureDeferredJelly   s>   ø€ Ø�I‰I”jÔ!Ø×$Ñ$ T§Y¡Y´Ô4Ø×!Ñ! $§*¡*¨d¯i©iÔ8Ør   ÚdeferredJellyrª   r¦   )r(   r«   s   ` r   Útest_deferredJellyFailurez(PBFailureTests.test_deferredJellyFailureú   s   ø€ ô	ð �~‰~˜o¨sÐ4HÓIÐIr   c                 ó4   ‡ — ˆ fd„}‰ j                  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                  | j                  d«       y)Ns3   twisted.spread.test.test_pbfailure.SynchronousErroré¯  ©rj   rl   r¤   s    €r   ÚfailureUnjellyablezBPBFailureTests.test_unjellyableFailure.<locals>.failureUnjellyable  s    ø€ Ø×ÑØ—	‘	ÐQôð r   r†   r°   r¦   )r(   r²   s   ` r   Útest_unjellyableFailurez&PBFailureTests.test_unjellyableFailure  s   ø€ ô	ð �~‰~Ð0°#Ð7IÓJÐJr   c                 ó4   ‡ — ˆ fd„}‰ j                  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                  | j                  d«       y)Ns/   twisted.spread.test.test_pbfailure.UnknownErroréÖ  r±   r¤   s    €r   ÚfailureUnknownz:PBFailureTests.test_unknownFailure.<locals>.failureUnknown  s    ø€ Ø×ÑØ—	‘	ÐMôð r   ÚunknownErrorr¶   r¦   )r(   r·   s   ` r   Útest_unknownFailurez"PBFailureTests.test_unknownFailure  s   ø€ ô	ð �~‰~˜n¨d°NÓCÐCr   c                 ó4   ‡ — ˆ fd„}‰ j                  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                 ó¼   •— | j                  t        «       ‰j                  | j                  t        «       ‰j                  | j                  | j                  «       y)NéÌ  ©rf   r"   r¡   rl   r¢   r£   rm   r¤   s    €r   ÚfailureSecurityz<PBFailureTests.test_securityFailure.<locals>.failureSecurity,  s>   ø€ Ø�I‰I”mÔ$Ø×$Ñ$ T§Y¡Y´Ô4Ø×!Ñ! $§*¡*¨d¯i©iÔ8Ør   Úsecurityr¼   r¦   )r(   r¾   s   ` r   Útest_securityFailurez#PBFailureTests.test_securityFailure%  s   ø€ ô	ð �~‰~˜j¨$°Ó@Ð@r   c                 ó4   ‡ — ˆ fd„}‰ j                  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                 ó¼   •— | j                  t        «       ‰j                  | j                  t        «       ‰j                  | j                  | j                  «       y)Néø§  r½   r¤   s    €r   ÚfailureDeferredSecurityzEPBFailureTests.test_deferredSecurity.<locals>.failureDeferredSecurity;  s>   ø€ Ø�I‰I”mÔ$Ø×$Ñ$ T§Y¡Y´Ô4Ø×!Ñ! $§*¡*¨d¯i©iÔ8Ør   ÚdeferredSecurityrÃ   r¦   )r(   rÄ   s   ` r   Útest_deferredSecurityz$PBFailureTests.test_deferredSecurity4  s   ø€ ô	ð �~‰~Ð0°%Ð9PÓQÐQr   c                 ó>   ‡ — ˆ fd„}‰ j                  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                 ó|   •— | j                  t        j                  «       ‰j                  | j                  d«       y)Nrd   é¤  )rf   r	   ÚNoSuchMethodrg   rh   r¤   s    €r   ÚfailureNoSuchz>PBFailureTests.test_noSuchMethodFailure.<locals>.failureNoSuchI  s)   ø€ Ø�I‰I”b—o‘oÔ&Ø�L‰L˜Ÿ™Ð)BÔCØr   ÚnosuchrÉ   )rœ   ÚAttributeError)r(   rË   s   ` r   Útest_noSuchMethodFailurez'PBFailureTests.test_noSuchMethodFailureC  s   ø€ ô	ð
 �~‰~˜h¨¨}¼nÓMÐMr   c                 óÂ   ‡ — ‰ j                   j                  «       }d„ }|j                  |«       ˆ fd„}|j                  |«       ‰ j                  j                  «        y)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                 ó$   — | j                  d«      S )Nr€   )rt   )ÚrootObjs    r   Ú	connectedz;PBFailureTests.test_copiedFailureLogging.<locals>.connectedZ  s   € Ø×%Ñ%Ð&<Ó=Ð=r   c                 ó�   •— t        j                  | «       ‰j                  t        «      }‰j	                  t        |«      d«       y )Né   )r   rn   ri   r   rj   rk   )Úfailurero   r(   s     €r   Ú	exceptionz;PBFailureTests.test_copiedFailureLogging.<locals>.exception_  s4   ø€ Ü�G‰G�GÔØ×)Ñ)Ô*>Ó?ˆDØ×ÑœS ›Y¨Õ*r   N)rY   rz   r?   ru   r^   rq   )r(   rB   rÒ   rÖ   s   `   r   Útest_copiedFailureLoggingz(PBFailureTests.test_copiedFailureLoggingP  sM   ø€ ð ×Ñ×,Ñ,Ó.ˆò	>ð 	
�‰�iÔ ô	+ð
 	
�‰�YÔØ�	‰	�‰Õr   c                 óJ  ‡ ‡— t        j                  t        d«      «      }t        j                  t        j                  |t        «       ¬«      «      }g Šˆˆ fd„} |«       }|j                  d«       ‰ j                  t        |j                  |«       ‰ j                  t        ‰«      d«       ‰d   }‰ j                  |j                  t        t        «      j                  d«      «       ‰ j                  |j                  d«       ‰ j                  |j                   d	«       y)
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 –— ‰j                  d«       y # t        j                  $ r} ‰j                  | «       Y d } ~ y d } ~ ww xY w­w)NzRemoteError not raised)r&   r	   ÚRemoteErrorÚappend)r”   rÖ   r(   s    €€r   ÚgeneratorFunczFPBFailureTests.test_throwExceptionIntoGenerator.<locals>.generatorFuncq  sF   øè ø€ ð4Ø’
ð —	‘	Ð2Õ3øô —>‘>ò &Ø× Ñ  ×%Ñ%ûð&üs)   ƒA… ‰A›A	®A¿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ÓKˆØˆ	õ	4ñ ‹oˆØ�‰�ŒØ×Ñœ-¨×)IÑ)IÈ3ÔOØ×Ñœ˜Y›¨Ô+Ø˜‰lˆØ×Ñ˜Ÿ™¬¬nÓ)=×)DÑ)DÀWÓ)MÔNØ×Ñ˜Ÿ™ 8Ô,Ø×Ñ˜×,Ñ,Ð.GÕ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   š   ss   „ Ø×Ñ×+Ñ+€Gòò&YòWòRòPòòóò09òJòKòDòAòRòNòó.Ir   ra   c                   ó<   — e Zd Zej                  j
                  ZdZy)Ú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y)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y)ÚFailureJellyingTestsz:
    Tests for the interaction of jelly and failures.
    c                 óê  — t        j                  t        «       «      }| j                  |j	                  t        «      t        «       | j                  |j	                  t
        «      t
        «       t        j                  t        j                  |t        «       ¬«      «      }| j                  |j	                  t        «      t        «       | j                  |j	                  t
        «      t
        «       y)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Ó:ˆØ�‰�h—n‘nÔ%6Ó7Ô9JÔKØ�‰�h—n‘n¤_Ó5´ÔGÜ—‘œuŸ{™{¨8¼\»^ÔLÓMˆØ�‰�f—l‘lÔ#4Ó5Ô7HÔIØ�‰�f—l‘l¤?Ó3´_ÕEr   c                 óx  — t        j                  t        «       «      }| j                  |j	                  t        «      t        «       | j                  |j	                  t
        «      t
        «       t        j                  t        j                  |t        «       ¬«      «      }t        j                  |«      }t        j                  t        j                  |t        «       ¬«      «      }| j                  |j	                  t        «      t        «       | j                  |j	                  t
        «      t
        «       y)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Ó:ˆØ�‰�h—n‘nÔ%6Ó7Ô9JÔKØ�‰�h—n‘n¤_Ó5´ÔGÜ—]‘]¤5§;¡;¨xÄÃÔ#PÓQˆ
Ü×'Ñ'¨
Ó3ˆ
Ü—m‘m¤E§K¡K°
ÄLÃNÔ$SÓTˆØ�‰�k×'Ñ'Ô(9Ó:Ô<MÔNØ�‰�k×'Ñ'¬Ó8¼/ÕJr   c                 óZ  — t        j                  t        d«      «      }t        j                  t        j                  |t        «       ¬«      «      }t        «       }|j                  |«       t        t        «      }dj                  |«      }| j                  ||j                  «       «       y)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ÓMˆÜ“ˆØ×Ñ˜fÔ%Üœ“Oˆ	ØM×TÑTØó
ˆð 	×Ñ˜¨¯©Ó):Õ;r   N)r   r   r   r   rÿ   r  r  r   r   r   r÷   r÷   ‘  s   „ ñò
Fò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     s8  ðñõ å "Ý Ý 'ß -Ñ -Ý 7Ý "ô
˜Iô ô˜9ô ô˜Ÿ™ô ô�r—x‘xô ô	�×"Ñ" B§H¡H¨b¯m©mô 	ô	�B—H‘H˜bŸm™mô 	ð €× Ñ ˜* jÔ 1Ø €× Ñ ˜-¨Ô 7Ø × Ñ × "Ñ " =Ô 1ô9+�—‘ô 9+ôx) × 2Ñ 2ô )ô
�X×&Ñ&ô 
ô"fI�^ô fIôR˜>ô ÷
"ñ "ô1<˜8×,Ñ,õ 1<r   