ó
    ×›‘hÃŠ  ã                  óÈ  • S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
  SSKJr  SSKJr  SSKJr  SSKJrJrJr  SS	KJr  SS
KJr  SSKJrJr  SSKJr   " S S\5      rSS.S(S jjr " S S\5      r  " S S\5      r! " S S\"5      r# " S S\\#S9r$ " S S\5      r% " S S\5      r&S)S jr' " S  S!\5      r( " S" S#\5      r) " S$ S%\5      r* " S& S'\5      r+g)*z6
Test cases for the L{twisted.python.failure} module.
é    )ÚannotationsN)Údistb)ÚStringIO©ÚFrameSummary)ÚTracebackType)ÚAnyÚ	GeneratorÚcast)ÚskipIf)Úraiser)ÚfailureÚreflect)ÚSynchronousTestCasec                  ó"   • \ rS rSrSrSS jrSrg)ÚComparableExceptioné   z+An exception that can be compared by value.c                ó�   • U R                   UR                   :H  =(       a'    U R                  [        [        U5      R                  :H  $ ©N)Ú	__class__Úargsr   r   )ÚselfÚothers     Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_failure.pyÚ__eq__ÚComparableException.__eq__   s6   € Ø—‘ %§/¡/Ñ1÷ 
Ø�I‰IœÔ1°5Ó9×>Ñ>Ñ>ð	
ó    © N)r   ÚobjectÚreturnÚbool)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__r   r   r   r   r      s
   † Ù5÷
r   r   F©ÚcaptureVarsc                ór   • U (       a  SnU   SS-    W$ ! [          a    [        R                  " U S9n U$ f = f)z.
Make a C{Failure} of a divide-by-zero error.
Úxyzé   r   r(   )ÚBaseExceptionr   ÚFailure)r)   ÚexampleLocalVarÚfs      r   ÚgetDivisionFailurer1   %   sH   € ö Øˆñ 	ð5Ø	ˆAŠð €Høô ó 5Ü�OŠO¨Ñ4‰Ø€Hð5ús   � ”6µ6c                  ó¬  • \ rS rSrSrS+S jrS+S jrS+S jrS+S jrS,S jr	S-S jr
S.S	 jr S/     S0S
 jjrS1S2S jjrS1S2S jjrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS3S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jr S+S jr!S+S  jr"S+S! jr#S+S" jr$S+S# jr%S+S$ jr&S4S% jr'S+S& jr(S+S' jr)S+S( jr*S)r+g*)5ÚFailureTestsé6   z
Tests for L{failure.Failure}.
c                ó  •  [        S5      e! [         a    [        R                  " 5       n Of = fUR	                  [
        [        5      nU R                  U[        5        U R                  UR                  [         5        g)z
Trapping a L{Failure}.
ÚtestN)	ÚNotImplementedErrorr-   r   r.   ÚtrapÚ
SystemExitÚRuntimeErrorÚassertEqualÚtype)r   r0   Úerrors      r   Útest_failAndTrapÚFailureTests.test_failAndTrap;   sb   € ð	"Ü% fÓ-Ð-øÜó 	"Ü—’Ó!ŠAð	"úà—‘”z¤<Ó0ˆØ×Ñ˜¤Ô-Ø×Ñ˜Ÿ™Ô!4Õ5s   ‚ �/®/c                óÔ   • [        5       n Ue! [         a    [        R                  " 5       n Of = fU R	                  [         UR
                  [        5      nU R                  X5        g)z†
If the wrapped C{Exception} is not a subclass of one of the
expected types, L{failure.Failure.trap} raises the wrapped
C{Exception}.
N)Ú
ValueErrorr-   r   r.   ÚassertRaisesr8   ÚOverflowErrorÚassertIs)r   Ú	exceptionr0   Ú	untrappeds       r   Útest_trapRaisesWrappedExceptionÚ,FailureTests.test_trapRaisesWrappedExceptionG   sV   € ô “Lˆ	ð	"ØˆOøÜó 	"Ü—’Ó!ŠAð	"úð ×%Ñ%¤j°!·&±&¼-ÓHˆ	Ø�‰�iÕ+s   Œ Ž0¯0c                ó¨   • [        5       n[        R                  " U5      n[        R                  " U5      nU R                  UR                  U5        g)zœ
A L{failure.Failure} constructed from another
L{failure.Failure} instance, has its C{value} property set to
the value of that L{failure.Failure} instance.
N)rA   r   r.   rD   Úvalue©r   rE   Úf1Úf2s       r   Útest_failureValueFromFailureÚ)FailureTests.test_failureValueFromFailureV   s9   € ô “Lˆ	Ü�_Š_˜YÓ'ˆÜ�_Š_˜RÓ ˆØ�‰�b—h‘h 	Õ*r   c                óò   • [        5       n[        R                  " U5      n UR                  [        5        U R                  WR                  U5        g! [
         a    [        R                  " 5       n N>f = f)z·
A L{failure.Failure} constructed without a C{exc_value}
argument, will search for an "original" C{Failure}, and if
found, its value will be used as the value for the new
C{Failure}.
N)rA   r   r.   r8   rC   r-   rD   rJ   rK   s       r   Ú!test_failureValueFromFoundFailureÚ.FailureTests.test_failureValueFromFoundFailurea   s[   € ô “Lˆ	Ü�_Š_˜YÓ'ˆð	#Ø�G‰G”MÔ"ð 	�‰�b—h‘h 	Õ*øô ó 	#Ü—’Ó"ŠBð	#ús   ¢A ÁA6Á5A6c                óT   • U R                  UR                  U5      U< SU< 35        g)z¯
Assert that C{s} starts with a particular C{prefix}.

@param s: The input string.
@type s: C{str}
@param prefix: The string that C{s} should start with.
@type prefix: C{str}
z is not the start of N)Ú
assertTrueÚ
startswith)r   ÚsÚprefixs      r   ÚassertStartsWithÚFailureTests.assertStartsWithq   s(   € ð 	�‰˜Ÿ™ VÓ,°±
Ð:OÐPQÉuÐ.UÕVr   c                óT   • U R                  UR                  U5      U< SU< 35        g)zª
Assert that C{s} end with a particular C{suffix}.

@param s: The input string.
@type s: C{str}
@param suffix: The string that C{s} should end with.
@type suffix: C{str}
z is not the end of N)rT   Úendswith)r   rV   Úsuffixs      r   ÚassertEndsWithÚFailureTests.assertEndsWith|   s'   € ð 	�‰˜Ÿ
™
 6Ó*¨v©jÐ8KÈAÉ5Ð,QÕRr   c                óH   • U R                  X5        U R                  X5        g)a  
Assert that the C{tb} traceback contains a particular C{prefix} and
C{suffix}.

@param tb: The traceback string.
@type tb: C{str}
@param prefix: The string that C{tb} should start with.
@type prefix: C{str}
@param suffix: The string that C{tb} should end with.
@type suffix: C{str}
N)rX   r]   )r   ÚtbrW   r\   s       r   ÚassertTracebackFormatÚ"FailureTests.assertTracebackFormat‡   s    € ð 	×Ñ˜bÔ)Ø×Ñ˜BÕ'r   c                óø  • [        US9n[        5       nU(       a  UR                  5         UR                  U5        UR	                  5       nSUR
                  UR                  =(       a    S=(       d    S4-  nSR                  [        R                  " UR                  5      [        R                  " UR                  5      UR
                  5      nU R                  XVU5        UR                  5        Vs/ s H  oˆR                  S5      (       d  M  UPM     n	nU(       a0  U R!                  / U	5        U(       a  SnOSnU R#                  X‰5        g
U R%                  / U	5        U R#                  S	U5        g
s  snf )aŽ  
Assert that L{printDetailedTraceback} produces and prints a detailed
traceback.

The detailed traceback consists of a header::

  *--- Failure #20 ---

The body contains the stacktrace::

  /twisted/test/test_failure.py:39: getDivisionFailure(...)

If C{captureVars} is enabled the body also includes a list of
globals and locals::

   [ Locals ]
     exampleLocalVar : 'xyz'
     ...
   ( Globals )
     ...

Or when C{captureVars} is disabled::

   [Capture of Locals and Globals disabled (use captureVars=True)]

When C{cleanFailure} is enabled references to other objects are removed
and replaced with strings.

And finally the footer with the L{Failure}'s value::

  exceptions.ZeroDivisionError: float division
  *--- End of Failure #20 ---

@param captureVars: Enables L{Failure.captureVars}.
@type captureVars: C{bool}
@param cleanFailure: Enables L{Failure.cleanFailure}.
@type cleanFailure: C{bool}
r(   z*--- Failure #%d%s---
z (pickled) Ú z#{}: {}
*--- End of Failure #{} ---
z  z  exampleLocalVar : "'xyz'"z  exampleLocalVar : 'xyz'zA [Capture of Locals and Globals disabled (use captureVars=True)]
N)r1   r   ÚcleanFailureÚprintDetailedTracebackÚgetvalueÚcountÚpickledÚformatr   Úqualr<   Úsafe_strrJ   ra   Ú
splitlinesrU   ÚassertNotEqualÚassertInr;   )
r   r)   re   r0   Úoutr`   ÚstartÚendÚlineÚlinesWithVarss
             r   ÚassertDetailedTracebackÚ$FailureTests.assertDetailedTraceback–   s)  € ôR ¨;Ñ7ˆÜ‹jˆÞØ�N‰NÔØ	× Ñ  Ô%à�\‰\‹^ˆØ)Ø�G‰GØ�Y‰Y×(˜=×0¨Sð-
ñ 
ˆð 6×<Ñ<Ü�LŠL˜Ÿ™Ó Ü×Ò˜QŸW™WÓ%Ø�G‰Gó
ˆð
 	×"Ñ" 2¨cÔ2ð +-¯-©-¬/ÓSª/ $¿_¹_ÈT×=RŸ©/ˆÐSæØ×Ñ  MÔ2ÞØ6‘à2�Ø�M‰M˜$Õ.à×Ñ˜R Ô/Ø�M‰MØWØõùò Ts   Ã6E7ÄE7c                óz  • U(       a  SnU  [        5       n[        5       nUR                  U5        UR                  5       nSnUR                   H  u  pxpšnXh SU	 SU S3-  nM     [        [        5      nU R                  USU S3U 5        U(       a'  U R                  [        R                  " SU5      5        gg)	aT  
Assert that L{printBriefTraceback} produces and prints a brief
traceback.

The brief traceback consists of a header::

  Traceback: <type 'exceptions.ZeroDivisionError'>: float division

And the footer::

  /twisted/test/test_failure.py:39:getDivisionFailure

@param captureVars: Enables L{Failure.captureVars}.
@type captureVars: C{bool}
ÚabcdeÚ Ú:Ú
zTraceback: ú: zexampleLocalVar.*abcdeN)r1   r   ÚprintBriefTracebackrg   ÚframesÚreprÚZeroDivisionErrorra   ÚassertIsNoneÚreÚsearch)r   r)   r/   r0   rp   r`   ÚstackÚmethodÚfilenameÚlinenoÚ	localVarsÚ
globalVarsÚzdes                r   ÚassertBriefTracebackÚ!FailureTests.assertBriefTracebackâ   sÃ   € ö  Ø%ˆOñ äÓ ˆÜ‹jˆØ	×Ñ˜cÔ"Ø�\‰\‹^ˆØˆØ?@¿x¼xÑ;ˆF˜f°Ø�z  6 (¨!¨F¨8°2Ð6Ñ6ŠEñ @Hô Ô$Ó%ˆØ×"Ñ"ØØ˜#˜˜bÐ!Øˆgô	
ö Ø×ÑœbŸišiÐ(@À"ÓEÕFð r   c           
     ó8  • U(       a  SnU  [        US9n[        5       nUR                  U5        UR                  5       nSnUR                   HA  u  pxpšnUSU SU	 SU S3-  nUS[
        R                  " X‰5      R                  5        S3-  nMC     U R                  US	U< [        R                  " UR                  5      < S
[        R                  " UR                  5      < S35        U(       a'  U R                  [        R                   " SU5      5        gg)a„  
Assert that L{printTraceback} produces and prints a default traceback.

The default traceback consists of a header::

  Traceback (most recent call last):

And the footer::

    File "twisted/test/test_failure.py", line 39, in getDivisionFailure
      1 / 0
    exceptions.ZeroDivisionError: float division

@param captureVars: Enables L{Failure.captureVars}.
@type captureVars: C{bool}
Úxyzzyr(   ry   z  File "z", line z, in r{   z    z"Traceback (most recent call last):r|   zexampleLocalVar.*xyzzyN)r1   r   ÚprintTracebackrg   r~   Ú	linecacheÚgetlineÚstripra   r   rk   r<   rl   rJ   r�   r‚   rƒ   )r   r)   r/   r0   rp   r`   r„   r…   r†   r‡   rˆ   r‰   s               r   ÚassertDefaultTracebackÚ#FailureTests.assertDefaultTraceback
  s  € ö" Ø%ˆOñ ä¨;Ñ7ˆÜ‹jˆØ	×Ñ˜ÔØ�\‰\‹^ˆØˆØ?@¿x¼xÑ;ˆF˜f°Ø�x ˜z¨°&°¸¸v¸hÀbÐIÑIˆEØ�tœI×-Ò-¨hÓ?×EÑEÓGÐHÈÐKÑKŠEñ @Hð 	×"Ñ"ØØ0ò Ü—’˜QŸV™VÖ$Ü× Ò  §¡Ö)ð	ô		
ö Ø×ÑœbŸišiÐ(@À"ÓEÕFð r   c                ó$   • U R                  5         g)zZ
L{printDetailedTraceback} returns a detailed traceback including the
L{Failure}'s count.
N©ru   ©r   s    r   Útest_printDetailedTracebackÚ(FailureTests.test_printDetailedTraceback8  s   € ð
 	×$Ñ$Õ&r   c                ó$   • U R                  5         g)z3
L{printBriefTraceback} returns a brief traceback.
N©r‹   r—   s    r   Útest_printBriefTracebackÚ%FailureTests.test_printBriefTraceback?  s   € ð 	×!Ñ!Õ#r   c                ó$   • U R                  5         g)z(
L{printTraceback} returns a traceback.
N©r“   r—   s    r   Útest_printTracebackÚ FailureTests.test_printTracebackE  s   € ð 	×#Ñ#Õ%r   c                ó"   • U R                  SS9  g)z²
L{printDetailedTraceback} captures the locals and globals for its
stack frames and adds them to the traceback, when called on a
L{Failure} constructed with C{captureVars=True}.
Tr(   Nr–   r—   s    r   Ú'test_printDetailedTracebackCapturedVarsÚ4FailureTests.test_printDetailedTracebackCapturedVarsK  s   € ð 	×$Ñ$°Ð$Ò6r   c                ó"   • U R                  SS9  g)z¾
L{printBriefTraceback} returns a brief traceback when called on a
L{Failure} constructed with C{captureVars=True}.

Local variables on the stack can not be seen in the resulting
traceback.
Tr(   Nr›   r—   s    r   Ú$test_printBriefTracebackCapturedVarsÚ1FailureTests.test_printBriefTracebackCapturedVarsS  s   € ð 	×!Ñ!¨dÐ!Ò3r   c                ó"   • U R                  SS9  g)z³
L{printTraceback} returns a traceback when called on a L{Failure}
constructed with C{captureVars=True}.

Local variables on the stack can not be seen in the resulting
traceback.
Tr(   NrŸ   r—   s    r   Útest_printTracebackCapturedVarsÚ,FailureTests.test_printTracebackCapturedVars]  s   € ð 	×#Ñ#°Ð#Ò5r   c                ó$   • U R                  SSS9  g)zz
C{printDetailedTraceback} includes information about local variables on
the stack after C{cleanFailure} has been called.
T)r)   re   Nr–   r—   s    r   Ú.test_printDetailedTracebackCapturedVarsCleanedÚ;FailureTests.test_printDetailedTracebackCapturedVarsCleanedg  s   € ð
 	×$Ñ$°ÀDÐ$ÒIr   c                óN   • U R                  [        [        R                  SSSS9  g)z]
L{failure.format_frames} raises a L{ValueError} if the supplied
C{detail} level is unknown.
NÚnoisia©Údetail)rB   rA   r   Úformat_framesr—   s    r   Útest_invalidFormatFramesDetailÚ+FailureTests.test_invalidFormatFramesDetailn  s(   € ð
 	×ÑÜœ×-Ñ-¨t°TÀ(ð 	ò 	
r   c                ó¦   • [        5       n[        R                  " U5      nUR                  [         5        U R	                  UR
                  U5        g r   )r:   r   r.   r8   r;   rJ   )r   Úer0   s      r   Útest_ExplictPassÚFailureTests.test_ExplictPassw  s7   € Ü‹NˆÜ�OŠO˜AÓˆØ	�‰Œ|ÔØ×Ñ˜Ÿ™ !Õ$r   c                óÐ   •  UR                  5         [        S5      e! [         a>    [        R                  " [
        R                  " 5       S   5      nUS   R                  s $ f = f)Nz3f.raiseException() didn't raise ZeroDivisionError!?é   éÿÿÿÿ)ÚraiseExceptionÚ	Exceptionr€   Ú	tracebackÚ
extract_tbÚsysÚexc_infors   )r   r0   r`   s      r   Ú_getInnermostFrameLineÚ#FailureTests._getInnermostFrameLine}  s\   € ð	SØ×ÑÔô
 ÐQÓRÐRøô	 !ó 	Ü×%Ò%¤c§l¢l£n°QÑ&7Ó8ˆBØ�b‘6—;‘;Òð	ús   ‚ �AA%Á$A%c                ó^   • [        5       nU R                  U5      nU R                  US5        g )Nú1 / 0)r1   rÂ   r;   )r   r0   Ú	innerlines      r   Útest_RaiseExceptionWithTBÚ&FailureTests.test_RaiseExceptionWithTB†  s*   € ÜÓ ˆØ×/Ñ/°Ó2ˆ	Ø×Ñ˜ GÕ,r   c                ó`   • U R                  [        R                  [        R                  5        g)zÁ
Creating a Failure with no arguments causes it to try to discover the
current interpreter exception state.  If no such state exists, creating
the Failure should raise a synchronous exception.
N)rB   r   ÚNoCurrentExceptionErrorr.   r—   s    r   Útest_ConstructionFailsÚ#FailureTests.test_ConstructionFails‹  s   € ð 	×Ñœ'×9Ñ9¼7¿?¹?ÕKr   c                ól   • [        5       nU R                  UR                  5       UR                  5        g)zƒ
If the C{Failure} has not been cleaned, then C{getTracebackObject}
returns the traceback object that captured in its constructor.
N)r1   r;   ÚgetTracebackObjectr`   ©r   r0   s     r   Útest_getTracebackObjectÚ$FailureTests.test_getTracebackObject“  s)   € ô
 Ó ˆØ×Ñ˜×-Ñ-Ó/°·±Õ6r   c                óÖ   •  SS-    U R                  WR	                  5       WR
                  5        g! [          a,    [        R                  " 5       n[        R                  " SS9n N`f = f)zK
C{captureVars=True} has no effect on the result of
C{getTracebackObject}.
r,   r   Tr(   N)r€   r   r.   r;   rÎ   r`   )r   ÚnoVarsFailureÚvarsFailures      r   Ú&test_getTracebackObjectFromCaptureVarsÚ3FailureTests.test_getTracebackObjectFromCaptureVars›  sX   € ð
	<Ø�ŠEð 	×Ñ˜×9Ñ9Ó;¸[¿^¹^ÕLøô !ó 	<Ü#ŸOšOÓ-ˆMÜ!Ÿ/š/°dÑ;ŠKð	<ús   ‚2 ²3A(Á'A(c                ó  • [        5       n[        R                  " UR                  5       5      nUR	                  5         [        R                  " UR                  5       5      nU R                  U5        U R                  X#5        g)z
If the Failure has been cleaned, then C{getTracebackObject} returns an
object that looks the same to L{traceback.extract_tb}.
N)r1   r¾   r¿   rÎ   re   ÚassertIsNotNoner;   ©r   r0   ÚexpectedÚobserveds       r   Ú test_getTracebackObjectFromCleanÚ-FailureTests.test_getTracebackObjectFromClean§  sd   € ô
 Ó ˆÜ×'Ò'¨×(<Ñ(<Ó(>Ó?ˆØ	�‰ÔÜ×'Ò'¨×(<Ñ(<Ó(>Ó?ˆØ×Ñ˜XÔ&Ø×Ñ˜Õ,r   c                óè   • [        SS9n[        R                  " UR                  5       5      nUR	                  5         [        R                  " UR                  5       5      nU R                  X#5        g)z‹
If the Failure was created with captureVars, then C{getTracebackObject}
returns an object that looks the same to L{traceback.extract_tb}.
Tr(   N)r1   r¾   r¿   rÎ   re   r;   rÙ   s       r   Ú.test_getTracebackObjectFromCaptureVarsAndCleanÚ;FailureTests.test_getTracebackObjectFromCaptureVarsAndClean³  sX   € ô
 ¨4Ñ0ˆÜ×'Ò'¨×(<Ñ(<Ó(>Ó?ˆØ	�‰ÔÜ×'Ò'¨×(<Ñ(<Ó(>Ó?ˆØ×Ñ˜Õ,r   c                ó€   • [         R                  " [        S5      5      nU R                  UR	                  5       5        g)zä
L{failure.Failure}s need not be constructed with traceback objects. If
a C{Failure} has no traceback information at all, C{getTracebackObject}
just returns None.

None is a good value, because traceback.extract_tb(None) -> [].
z
some errorN)r   r.   r½   r�   rÎ   rÏ   s     r   Ú'test_getTracebackObjectWithoutTracebackÚ4FailureTests.test_getTracebackObjectWithoutTraceback¾  s.   € ô �OŠOœI lÓ3Ó4ˆØ×Ñ˜!×.Ñ.Ó0Õ1r   c                óÄ   •  SS-    [        R                  " W5      nU R                  UR                  W5        g! [          a    [        R                  " 5       u  pn NWf = f)z©
If a L{failure.Failure} is constructed with an exception but no
traceback in Python 3, the traceback will be extracted from the
exception's C{__traceback__} attribute.
r,   r   N)r-   rÀ   rÁ   r   r.   rD   r`   )r   ÚklassrE   r`   r0   s        r   Ú$test_tracebackFromExceptionInPython3Ú1FailureTests.test_tracebackFromExceptionInPython3É  sQ   € ð	2Ø�ŠEô �OŠO˜IÓ&ˆØ�‰�a—d‘d˜BÕøô ó 	2Ü#&§<¢<£>Ñ ˆEšbð	2ús   ‚: º"AÁAc                ó  • [        5       nU R                  UR                  5        U R                  UR                  R
                  UR                  5        UR                  5         U R                  UR                  R
                  5        g)zn
L{failure.Failure.cleanFailure} sets the C{__traceback__} attribute of
the exception to L{None} in Python 3.
N)r1   rØ   r`   rD   rJ   Ú__traceback__re   r�   rÏ   s     r   Ú*test_cleanFailureRemovesTracebackInPython3Ú7FailureTests.test_cleanFailureRemovesTracebackInPython3Ö  s\   € ô
 Ó ˆØ×Ñ˜QŸT™TÔ"Ø�‰�a—g‘g×+Ñ+¨Q¯T©TÔ2Ø	�‰ÔØ×Ñ˜!Ÿ'™'×/Ñ/Õ0r   c                óœ   • [        5       n[        5       n[        UR                  5       US9  U R	                  SUR                  5       5        g)zÂ
The traceback captured by a L{Failure} is compatible with the stdlib
L{dis.distb} function as used in post-mortem debuggers. Specifically,
it doesn't cause that function to raise an exception.
)Úfilez --> N)r1   r   r   rÎ   ro   rg   )r   r0   Úbufs      r   Ú
test_distbÚFailureTests.test_distbá  s<   € ô Ó ˆÜ‹jˆÜˆa×"Ñ"Ó$¨3Ò/ð 	�‰�g˜sŸ|™|›~Õ.r   c                óŒ   • [        5       n[        R                  " [        5      nU R	                  [        U5      SU< S35        g)zk
The C{repr} of a L{failure.Failure} shows the type and string
representation of the underlying exception.
z <twisted.python.failure.Failure z: division by zero>N)r1   r   ÚfullyQualifiedNamer€   r;   r   )r   r0   ÚtypeNames      r   Ú	test_reprÚFailureTests.test_reprî  s8   € ô
 Ó ˆÜ×-Ò-Ô.?Ó@ˆØ×ÑÜ�ŒGÛJRÐTõ	
r   c                óÖ   • [        5       nUR                  Ul        U R                  5       nU R                  [	        U5      S:¬  5        USS  H  nU R                  SUS   5        M     g)z<
C{Failure.stack} is gettable and settable, but depreacted.
r,   éþÿÿÿNzFtwisted.python.failure.Failure.stack was deprecated in Twisted 24.10.0Úmessage)r1   r„   ÚflushWarningsrT   Úlenr;   )r   r0   ÚwarningsÚws       r   Útest_stackDeprecationÚ"FailureTests.test_stackDeprecationú  sb   € ô Ó ˆØ—'‘'ˆŒØ×%Ñ%Ó'ˆØ�‰œ˜H›¨Ñ*Ô+Ø˜"˜#“ˆAØ×ÑØXØ�)‘öò r   c                ó°  • [        S5      n[        R                  " U5      R                  R	                  5       n[        R                  R                  U5      nU R                  U[        R                  5        UR                  R	                  5       nU R                  UR                  S5      S-   UR                  S5      5        U R                  X$5        g)zM
C{Failure._withoutTraceback(exc)} gives the same result as
C{Failure(exc)}.
Úhellorh   r,   N)	r€   r   r.   Ú__dict__ÚcopyÚ_withoutTracebackÚassertIsInstancer;   Úpop)r   ÚexcÚdict1Úfailure2Údict2s        r   Útest_failureWithoutTracebackÚ)FailureTests.test_failureWithoutTraceback  s    € ô
   Ó(ˆÜ—’ Ó$×-Ñ-×2Ñ2Ó4ˆÜ—?‘?×4Ñ4°SÓ9ˆØ×Ñ˜h¬¯©Ô8Ø×!Ñ!×&Ñ&Ó(ˆð 	×Ñ˜Ÿ™ 7Ó+¨aÑ/°·±¸7Ó1CÔDð 	×Ñ˜Õ&r   c                óL  • [        S5      n[        R                  " U5      nU R                  U5        [        R                  R	                  U5      nU R                  U5         [        S5      e! [
         a    [        R                  " 5       n Of = fU R                  U5        g)zU
C{Failure(exc)} and C{Failure._withoutTraceback(exc)} can be pickled
and unpickled.
r   ÚbooN)r   r   r.   ÚassertPicklingRoundtripsr  r-   )r   r  Úfailure1r  Úfailure3s        r   Útest_failurePicklingÚ!FailureTests.test_failurePickling  s‡   € ô
 " 'Ó*ˆÜ—?’? 3Ó'ˆØ×%Ñ% hÔ/ô
 —?‘?×4Ñ4°SÓ9ˆØ×%Ñ% hÔ/ð	)Ü% eÓ,Ð,øÜó 	)Ü—’Ó(ŠHð	)úà×%Ñ% hÕ/s   Á$A/ Á/BÂBc                óB  • [         R                  " [         R                  " U5      5      nUR                  R	                  5       nSUS'   SUS'   UR                  R	                  5       nU R                  X45        U R                  UR                  UR                  5        g)zc
The failure can be pickled and unpickled, and the C{parents} attribute
is included in the pickle.
r,   ri   Nr`   )ÚpickleÚloadsÚdumpsr  r  r;   r~   )r   Úoriginal_failurer  rÚ   Úresults        r   r  Ú%FailureTests.assertPicklingRoundtrips/  s€   € ô
 —<’<¤§¢Ð-=Ó >Ó?ˆØ#×,Ñ,×1Ñ1Ó3ˆØˆ�ÑØˆ�‰Ø×"Ñ"×'Ñ'Ó)ˆØ×Ñ˜Ô*Ø×Ñ˜Ÿ™Ð*:×*AÑ*AÕBr   c                óœ   • [         R                  " [        S5      5      nU R                  UR	                  5       S   UR
                  5        g)z/
C{Failure.parents} is included in the pickle.
r   ÚparentsN)r   r.   r   r;   Ú__getstate__r  rÏ   s     r   Ú#test_failurePicklingIncludesParentsÚ0FailureTests.test_failurePicklingIncludesParents<  s8   € ô �OŠOÔ/°Ó8Ó9ˆØ×Ñ˜Ÿ™Ó)¨)Ñ4°a·i±iÕ@r   c                ó6  • [         R                  " [        5       5      nUR                  SS Ul        [        R
                  " [        R                  " U5      5      nUR                  SS Ul        U R                  UR                  UR                  SS 5        g)z?
C{Failure.frames} can be set, both before and after pickling.
Nr»   )r   r.   r1   r~   r  r  r  r;   ©r   r  r  s      r   Útest_settableFramesÚ FailureTests.test_settableFramesC  sw   € ô #Ÿ?š?Ô+=Ó+?Ó@ÐØ"2×"9Ñ"9¹!Ð"<ÐÔÜ—<’<¤§¢Ð-=Ó >Ó?ˆØ"Ÿ/™/¨#¨2Ð.ˆŒØ×Ñ˜Ÿ™Ð*:×*AÑ*AÀ#À2Ð*FÕGr   c                óæ   • [         R                  " [        S5      5      nUR                  SS Ul        [        R
                  " [        R                  " U5      5      nUR                  SS Ul        g)z[
C{Failure.parents} can be set, both before and after pickling.

This is used by Foolscap.
r   N)r   r.   r   r  r  r  r  r   s      r   Útest_settableParentsÚ!FailureTests.test_settableParentsM  sX   € ô #Ÿ?š?Ô+>¸wÓ+GÓHÐØ#3×#;Ñ#;¹AÐ#>ÐÔ Ü—<’<¤§¢Ð-=Ó >Ó?ˆØ#×+Ñ+©AÐ.ˆÕr   r   N©r    ÚNone)rV   ÚstrrW   r(  r    r'  )rV   r(  r\   r(  r    r'  )r`   r(  rW   r(  r\   r(  r    r'  )FF)r)   r!   re   r!   r    r'  )F)r)   r!   r    r'  )r0   úfailure.Failurer    z
str | None)r  r)  r    r'  ),r"   r#   r$   r%   r&   r>   rG   rN   rQ   rX   r]   ra   ru   r‹   r“   r˜   rœ   r    r£   r¦   r©   r¬   r³   r·   rÂ   rÇ   rË   rÐ   rÕ   rÜ   rß   râ   ræ   rê   rï   rô   rý   r
  r  r  r  r!  r$  r'   r   r   r   r3   r3   6   sõ   † ñô
6ô,ô	+ô+ô 	Wô	Sô(ð  ?DðJØðJØ7;ðJà	õJöX&GöP,Gô\'ô$ô&ô7ô4ô6ôJô
ô%ôSô-ô
Lô7ô
Mô
-ô	-ô	2ô ô	1ô/ô

ôô'ô"0ô,CôAôH÷	/r   r3   c                  ó"   • \ rS rSrSrSS jrSrg)Ú	BrokenStriY  zV
An exception class the instances of which cannot be presented as strings
via L{str}.
c                ó   • U er   r   r—   s    r   Ú__str__ÚBrokenStr.__str___  s   € àˆ
r   r   N©r    r(  ©r"   r#   r$   r%   r&   r-  r'   r   r   r   r+  r+  Y  s   † ñ÷
r   r+  c                  ó"   • \ rS rSrSrSS jrSrg)ÚBrokenExceptionMetaclassid  zU
A metaclass for an exception type which cannot be presented as a string via
L{str}.
c                ó   • [        S5      e)Nz#You cannot make a string out of me.)rA   r—   s    r   r-  Ú BrokenExceptionMetaclass.__str__j  s   € ÜÐ>Ó?Ð?r   r   Nr/  r0  r   r   r   r2  r2  d  s   † ñ÷
@r   r2  c                  ó   • \ rS rSrSrSrg)ÚBrokenExceptionTypein  zU
The aforementioned exception type which cannot be presented as a string via
L{str}.
r   N)r"   r#   r$   r%   r&   r'   r   r   r   r6  r6  n  s   † ôr   r6  )Ú	metaclassc                  óh   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSrg)ÚGetTracebackTestsiv  z$
Tests for L{Failure.getTraceback}.
c                óŽ   • [        5       n[        R                  " U5      nUR                  US9nU R	                  U[
        5        g)z»
Construct a L{Failure} with an exception that raises an exception from
its C{__str__} method and then call C{getTraceback} with the specified
detail and verify that it returns a string.
r°   N)r+  r   r.   ÚgetTracebackr  r(  )r   r±   Úxr0   r¾   s        r   Ú_brokenValueTestÚ"GetTracebackTests._brokenValueTest{  s9   € ô ‹KˆÜ�OŠO˜AÓˆØ—N‘N¨&�NÐ1ˆ	Ø×Ñ˜i¬Õ-r   c                ó&   • U R                  S5        g)zÈ
A L{Failure} might wrap an exception with a C{__str__} method which
raises an exception.  In this case, calling C{getTraceback} on the
failure with the C{"brief"} detail does not raise an exception.
ÚbriefN©r=  r—   s    r   Útest_brokenValueBriefDetailÚ-GetTracebackTests.test_brokenValueBriefDetail†  s   € ð 	×Ñ˜gÕ&r   c                ó&   • U R                  S5        g)úI
Like test_brokenValueBriefDetail, but for the C{"default"} detail case.
ÚdefaultNrA  r—   s    r   Útest_brokenValueDefaultDetailÚ/GetTracebackTests.test_brokenValueDefaultDetailŽ  ó   € ð 	×Ñ˜iÕ(r   c                ó&   • U R                  S5        g)rE  ÚverboseNrA  r—   s    r   Útest_brokenValueVerboseDetailÚ/GetTracebackTests.test_brokenValueVerboseDetail”  rI  r   c                óŠ   • [         R                  " [        5       5      nUR                  US9nU R	                  U[
        5        g)zÀ
Construct a L{Failure} with an exception type that raises an exception
from its C{__str__} method and then call C{getTraceback} with the
specified detail and verify that it returns a string.
r°   N)r   r.   r6  r;  r  r(  )r   r±   r0   r¾   s       r   Ú_brokenTypeTestÚ!GetTracebackTests._brokenTypeTestš  s6   € ô �OŠOÔ/Ó1Ó2ˆØ—N‘N¨&�NÐ1ˆ	Ø×Ñ˜i¬Õ-r   c                ó&   • U R                  S5        g)a  
        A L{Failure} might wrap an
        newPublisher(evt)
xception the type object of which has a
        C{__str__} method which raises an exception.  In this case, calling
        C{getTraceback} on the failure with the C{"brief"} detail does not raise
        an exception.
r@  N©rO  r—   s    r   Útest_brokenTypeBriefDetailÚ,GetTracebackTests.test_brokenTypeBriefDetail¤  s   € ð 	×Ñ˜WÕ%r   c                ó&   • U R                  S5        g)zH
Like test_brokenTypeBriefDetail, but for the C{"default"} detail case.
rF  NrR  r—   s    r   Útest_brokenTypeDefaultDetailÚ.GetTracebackTests.test_brokenTypeDefaultDetail¯  ó   € ð 	×Ñ˜YÕ'r   c                ó&   • U R                  S5        g)zH
Like test_brokenTypeBriefDetail, but for the C{"verbose"} detail case.
rK  NrR  r—   s    r   Útest_brokenTypeVerboseDetailÚ.GetTracebackTests.test_brokenTypeVerboseDetailµ  rX  r   r   N)r±   r(  r    r'  r&  )r"   r#   r$   r%   r&   r=  rB  rG  rL  rO  rS  rV  rZ  r'   r   r   r   r9  r9  v  s/   † ñô	.ô'ô)ô)ô.ô	&ô(÷(r   r9  c                  ó>   • \ rS rSrSr\" \SL S5      SS j5       rSrg)ÚFindFailureTestsi¼  z@
Tests for functionality related to identifying the C{Failure}.
Nzraiser extension not availablec                ó  •  [         R                  " 5         U R                  S5        g! [         R                   aF    [        R
                  " 5       nU R                  UR                  [         R                  5      5         gf = f)z¼
Pyrex and Cython are known to insert fake stack frames so as to give
more Python-like tracebacks. These stack frames with empty code objects
should not break extraction of the exception.
z$No exception raised from extension?!N)r   r¼   ÚfailÚRaiserExceptionr   r.   rT   ÚcheckrÏ   s     r   Ú/test_failureConstructionWithMungedStackSucceedsÚ@FindFailureTests.test_failureConstructionWithMungedStackSucceedsÁ  s`   € ð	>Ü×!Ò!Ô#ð
 �I‰IÐ<Õ=øô	 ×%Ñ%ó 	=Ü—’Ó!ˆAØ�O‰O˜AŸG™G¤F×$:Ñ$:Ó;Ö<ð	=ús   ‚) ©ABÂBr   r&  )	r"   r#   r$   r%   r&   r   r   rb  r'   r   r   r   r]  r]  ¼  s'   † ññ ˆF�dˆNÐ<Ó=ó>ó >ó>r   r]  c                ó   • [        XU5      $ r   r   )Úfnr‡   ÚnameÚtexts       r   Ú_tbrh  Õ  s   € Ü˜ DÓ)Ð)r   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)ÚFormattableTracebackTestsiÙ  zò
Whitebox tests that show that L{failure._Traceback} constructs objects that
can be used by L{traceback.extract_tb}.

If the objects can be used by L{traceback.extract_tb}, then they can be
formatted using L{traceback.format_tb} and friends.
c           	     ó¢   • [         R                  " SSS0 0 //5      nU R                  [        R                  " U5      [        SSSS5      /5        g)zÌ
A C{_Traceback} object constructed with a single frame should be able
to be passed to L{traceback.extract_tb}, and we should get a singleton
list containing a (filename, lineno, methodname, line) tuple.
r…   úfilename.pyé{   N)r   Ú
_Tracebackr;   r¾   r¿   rh  ©r   r`   s     r   Útest_singleFrameÚ*FormattableTracebackTests.test_singleFrameâ  sP   € ô ×Ò (¨M¸3ÀÀBÐ!GÐ HÓIˆð 	×ÑÜ× Ò  Ó$¤s¨=¸#¸xÈÓ'NÐ&Oõ	
r   c           
     óB  • [         R                  " SSS0 0 /SSS0 0 //5      nU R                  [        R                  " U5      [        SSSS5      [        SSSS5      /5        U R                  [        R                  " UR                  5      [        SSSS5      /5        g)z­
A C{_Traceback} object constructed with multiple frames should be able
to be passed to L{traceback.extract_tb}, and we should get a list
containing a tuple for each frame.
Úmethod1rl  rm  Úmethod2éë   N)r   rn  r;   r¾   r¿   rh  Úextract_stackÚtb_framero  s     r   Útest_manyFramesÚ)FormattableTracebackTests.test_manyFramesð  s©   € ô ×Òà˜M¨3°°BÐ7Ø˜M¨3°°BÐ7ðó
ˆð 	×ÑÜ× Ò  Ó$ä�M 3¨	°4Ó8Ü�M 3¨	°4Ó8ðô	
ð 	×ÑÜ×#Ò# B§K¡KÓ0ä�M 3¨	°4Ó8ðõ	
r   r   Nr&  )r"   r#   r$   r%   r&   rp  rx  r'   r   r   r   rj  rj  Ù  s   † ñô
÷
r   rj  c                  ó6   • \ rS rSrSrSS jrSS jrSS jrSrg)	ÚFakeAttributesTestsi  a:  
_Frame, _Code and _TracebackFrame objects should possess some basic
attributes that qualify them as fake python objects, allowing the return of
_Traceback to be used as a fake traceback. The attributes that have zero or
empty values are there so that things expecting them find them (e.g. post
mortem debuggers).
c                óx  • [         R                  " SS5      nSS0nSS0n[         R                  " SSSUU4U5      nU R                  UR                  U5        U R                  UR                  U5        U R                  UR                  [         R                  5        U R                  UR                  U5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  S5        U R                  UR                  [        S5      5        g)	z°
L{_Frame} instances have the C{f_globals} and C{f_locals} attributes
bound to C{dict} instance.  They also have the C{f_code} attribute
bound to something like a code object.
)ÚdummyparentÚdummyparentfileéo   NNNÚ	local_varé*   Ú
global_varéd   Ú	dummynameÚdummyfilename)r   Ú_Framer;   Ú	f_globalsÚf_localsr  Úf_codeÚ_CodeÚf_backÚ
f_builtinsÚdictÚf_lastiÚintÚf_linenoÚf_tracer<   )r   Ú
back_frameÚfake_localsÚfake_globalsÚframes        r   Útest_fakeFrameAttributesÚ,FakeAttributesTests.test_fakeFrameAttributes  s  € ô —^’^ðð ó	
ˆ
ð # BÐ'ˆØ$ cÐ*ˆÜ—’àØØØØðð ó	
ˆð 	×Ñ˜Ÿ™¨,Ô7Ø×Ñ˜Ÿ™¨Ô5Ø×Ñ˜eŸl™l¬G¯M©MÔ:Ø×Ñ˜Ÿ™ zÔ2Ø×Ñ˜e×.Ñ.´Ô5Ø×Ñ˜eŸm™m¬SÔ1Ø×Ñ˜Ÿ™¨Ô,Ø×Ñ˜eŸm™m¬T°$«ZÕ8r   c                ój  • [         R                  " SS5      nU R                  UR                  S5        U R                  UR                  S5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                  [        5        U R                  UR                   [        5        U R                  UR"                  [        5        U R                  UR$                  [        5        U R                  UR&                  [        5        U R                  UR(                  [        5        U R                  UR*                  [        5        U R                  UR,                  [.        5        U R                  UR1                  5       [        5        g)ú>
See L{FakeAttributesTests} for more details about this test.
r„  r…  N)r   rŠ  r;   Úco_nameÚco_filenamer  Úco_argcountr�  Úco_codeÚbytesÚco_cellvarsÚtupleÚ	co_constsÚco_firstlinenoÚco_flagsÚ	co_lnotabÚco_freevarsÚco_posonlyargcountÚco_kwonlyargcountÚco_namesÚ
co_nlocalsÚco_stacksizeÚco_varnamesÚlistÚco_positions)r   Úcodes     r   Útest_fakeCodeAttributesÚ+FakeAttributesTests.test_fakeCodeAttributes;  s  € ô �}Š}˜[¨/Ó:ˆØ×Ñ˜Ÿ™ {Ô3Ø×Ñ˜×)Ñ)¨?Ô;Ø×Ñ˜d×.Ñ.´Ô4Ø×Ñ˜dŸl™l¬EÔ2Ø×Ñ˜d×.Ñ.´Ô6Ø×Ñ˜dŸn™n¬eÔ4Ø×Ñ˜d×1Ñ1´3Ô7Ø×Ñ˜dŸm™m¬SÔ1Ø×Ñ˜dŸn™n¬eÔ4Ø×Ñ˜d×.Ñ.´Ô6Ø×Ñ˜d×5Ñ5´sÔ;Ø×Ñ˜d×4Ñ4´cÔ:Ø×Ñ˜dŸm™m¬UÔ3Ø×Ñ˜dŸo™o¬sÔ3Ø×Ñ˜d×/Ñ/´Ô5Ø×Ñ˜d×.Ñ.´Ô5Ø×Ñ˜d×/Ñ/Ó1´5Õ9r   c                óN  • [         R                  " SSS0 0 4S5      n[         R                  " U5      nU R                  UR                  U5        U R                  UR
                  S5        U R                  UR                  [        5        U R                  [        US5      5        g)r™  r„  r…  r�  NÚtb_next)r   r†  Ú_TracebackFramer;   rw  Ú	tb_linenor  Útb_lastir�  rT   Úhasattr)r   r•  Útraceback_frames      r   Útest_fakeTracebackFrameÚ+FakeAttributesTests.test_fakeTracebackFrameR  sŠ   € ô —’Ø˜/¨2¨r°2Ð6Øó
ˆô "×1Ò1°%Ó8ˆØ×Ñ˜×1Ñ1°5Ô9Ø×Ñ˜×2Ñ2°BÔ7Ø×Ñ˜o×6Ñ6¼Ô<Ø�‰œ °Ó;Õ<r   r   Nr&  )	r"   r#   r$   r%   r&   r–  r¯  r¸  r'   r   r   r   r{  r{    s   † ñô#9ôJ:÷.=r   r{  c                  ó6   • \ rS rSrSrSS jrSS jrSS jrSrg)	ÚDebugModeTestsia  z>
Failure's debug mode should allow jumping into the debugger.
c                óô   ^ ^^• [         R                  m[        R                  R                  mSUU4S jjnT R                  U5        / T l        SSU 4S jjjnU[         l        [        R                  " 5         g)z;
Override pdb.post_mortem so we can make sure it's called.
c                 óF   >• T[         l        T [        R                  l        g r   )ÚpdbÚpost_mortemr   r.   Ú__init__)ÚorigInitr¿  s   €€r   ÚrestoreÚ%DebugModeTests.setUp.<locals>.restoren  s   ø€ Ø)ŒCŒOØ'/ŒG�O‰OÕ$r   Nc                ó<   >• TR                   R                  U 5        g r   )r  Úappend)Útr   s    €r   Úlogging_post_mortemÚ1DebugModeTests.setUp.<locals>.logging_post_mortemv  s   ø€ Ø�K‰K×Ñ˜qÕ!r   r&  r   )rÆ  zTracebackType | Noner    r'  )r¾  r¿  r   r.   rÀ  Ú
addCleanupr  ÚstartDebugMode)r   rÂ  rÇ  rÁ  r¿  s   `  @@r   ÚsetUpÚDebugModeTests.setUpf  s[   ú€ ô
 —o‘oˆÜ—?‘?×+Ñ+ˆ÷	0ð 	0ð 	�‰˜Ô à24ˆŒ÷	"ñ 	"ð .ŒŒÜ×ÒÕ r   c                óú   •  SS-    U R                  U R                  W/5        U R                  WR                  5        g! [          a0    [        R                  " 5       u  pn[        R                  " 5       n Nrf = f)zf
If startDebugMode() is called, calling Failure() will first call
pdb.post_mortem with the traceback.
r,   r   N)	r-   rÀ   rÁ   r   r.   r;   r  ÚassertFalser)   ©r   Útypr  r`   r0   s        r   Útest_regularFailureÚ"DebugModeTests.test_regularFailure|  sd   € ð
	"Ø�ŠEð 	×Ñ˜Ÿ™ r dÔ+Ø×Ñ˜Ÿ™Õ'øô	 ó 	"ÜŸ<š<›>‰LˆC�bÜ—’Ó!ŠAð	"ús   ‚A  Á 7A:Á9A:c                óø   •  SS-    U R                  U R                  W/5        U R                  WR                  5        g! [          a/    [        R                  " 5       u  pn[        R                  " SS9n Nqf = f)zS
If startDebugMode() is called, passing captureVars to Failure() will
not blow up.
r,   r   Tr(   N)	r-   rÀ   rÁ   r   r.   r;   r  rT   r)   rÏ  s        r   Útest_captureVarsÚDebugModeTests.test_captureVars‰  sd   € ð
	2Ø�ŠEð 	×Ñ˜Ÿ™ r dÔ+Ø�‰˜Ÿ™Õ&øô	 ó 	2ÜŸ<š<›>‰LˆC�bÜ—’¨DÑ1ŠAð	2ús   ‚A  Á 6A9Á8A9)r  Nr&  )	r"   r#   r$   r%   r&   rË  rÑ  rÔ  r'   r   r   r   r»  r»  a  s   † ñô!ô,(÷'r   r»  c                  óV   • \ rS rSrSr      S
S jrSS jrSS jrSS jrSS jr	Sr
g	)ÚExtendedGeneratorTestsi—  zM
Tests C{failure.Failure} support for generator features added in Python 2.5
c                ój   •  UR                  U5        U R                  S5        g ! [         a     g f = f)Nz<throwExceptionIntoGenerator should have raised StopIteration)ÚthrowExceptionIntoGeneratorr_  ÚStopIteration)r   r0   Úgs      r   Ú_throwIntoGeneratorÚ*ExtendedGeneratorTests._throwIntoGeneratorœ  s9   € ð	YØ×)Ñ)¨!Ô,ð �I‰IÐWÕXøô ó 	Ùð	ús   ‚% ¥
2±2c                óL  ^ ^• / mSU U4S jjnU" 5       n[        5       n[        U5        T R                  X25        T R                  TS   S   [        5        T R                  TS   S   [        5        T R                  [        R                  " TS   S   5      S   S   S5        g)	zZ
It should be possible to throw the exception that a Failure
represents into a generator.
c               3  ó¢   >#   •  S v •  T R                  S5        g ! [         a'    TR                  [        R                  " 5       5         g f = f7f)Nz$Yield should have yielded exception.)r_  r-   rÅ  rÀ   rÁ   )r   Ústuffs   €€r   Ú	generatorÚJExtendedGeneratorTests.test_throwExceptionIntoGenerator.<locals>.generator­  s@   øé € ðBÛð —	‘	Ð@ÕAøô !ó -Ø—‘œSŸ\š\›^Ö,ð-üó%   ƒA… ‰A›.AÁ	AÁAÁAr   r,   rº   r»   rÅ   N©r    zGenerator[None, None, None])r1   ÚnextrÜ  r;   r€   r  r¾   r¿   )r   rá  rÛ  r0   rà  s   `   @r   Ú test_throwExceptionIntoGeneratorÚ7ExtendedGeneratorTests.test_throwExceptionIntoGenerator¦  s›   ù€ ð
 ˆ÷	Bð 	Bñ ‹KˆÜÓ ˆÜˆQŒØ× Ñ  Ô&à×Ñ˜˜q™ !™Ô&7Ô8Ø×Ñ˜e A™h q™kÔ+<Ô=à×Ñœ×-Ò-¨e°A©h°q©kÓ:¸2Ñ>¸rÑBÀGÕLr   c                ó  ^ ^• [        5       nUR                  5         UR                  5       n/ mSUU 4S jjnU" 5       n[        U5        T R	                  X5        T R                  [        T5      S5        T R                  X!R                  5       5        T R                  TS   R                  5       UR                  5       5        T R                  STS   R                  5       5        T R                  SUR                  5       5        g)zÇ
When a Failure is constructed in the context of an exception
handler that is handling an exception raised by
throwExceptionIntoGenerator, the new Failure should be chained to that
original Failure.
c               3  ó¢   >#   •  S v •  TR                  S5        g ! [         a'    T R                  [        R                  " 5       5         g f = f7f)NzNo exception sent to generator)r_  r-   rÅ  r   r.   )ÚnewFailuresr   s   €€r   rá  ÚVExtendedGeneratorTests.test_failureConstructionFindsOriginalFailure.<locals>.generatorÌ  sB   øé € ð<Ûð —	‘	Ð:Õ;øô !ó 6Ø×"Ñ"¤7§?¢?Ó#4Ö5ð6ürã  r,   r   rá  Nrä  )
r1   re   r;  rå  rÜ  r;   rú   rn   ro   ÚassertNotIn)r   r0   Úoriginal_failure_strrá  rÛ  rê  s   `    @r   Ú,test_failureConstructionFindsOriginalFailureÚCExtendedGeneratorTests.test_failureConstructionFindsOriginalFailure¿  sÖ   ù€ ô Ó ˆØ	�‰ÔØ Ÿ~™~Ó/Ðàˆ÷	<ð 	<ñ ‹KˆÜˆQŒØ× Ñ  Ô&à×Ñœ˜[Ó)¨1Ô-ð 	×ÑÐ-¯~©~Ó/?Ô@ð 	×Ñ˜K¨™N×7Ñ7Ó9¸1¿>¹>Ó;KÔLØ�‰�k ;¨q¡>×#>Ñ#>Ó#@ÔAØ×Ñ˜ a§n¡nÓ&6Õ7r   c                óp   ^ • SU 4S jjnU" 5       n[        U5        [        5       nT R                  X25        g)zš
When a generator reraises a different exception, creating a L{Failure}
inside the generator should find the reraised exception rather than
original one.
c               3  óÊ   >#   •   S v •  g ! [          a    / S      g f = f! [          a6    T R                  [        R                  " 5       R                  [
        5         g f = f7f©Nr,   )r-   r  r   r.   rJ   Ú
IndexErrorr—   s   €r   rá  ÚJExtendedGeneratorTests.test_ambiguousFailureInGenerator.<locals>.generatorê  sV   øé € ðKðÜøÜ$ó Ø�q”Eðûä ó KØ×%Ñ%¤g§o¢oÓ&7×&=Ñ&=¼zÖJðKüs:   ƒA#† ŠA#‹š  ›A#œ�   =A ÁA#ÁA Á A#Nrä  )rå  r1   rÜ  ©r   rá  rÛ  r0   s   `   r   Ú test_ambiguousFailureInGeneratorÚ7ExtendedGeneratorTests.test_ambiguousFailureInGeneratorã  s/   ø€ ÷	Kñ ‹KˆÜˆQŒÜÓ ˆØ× Ñ  Õ&r   c                óð   • SS jnU" 5       n[        U5        [        5       n U R                  X25        g! [         a6    U R	                  [
        R                  " 5       R                  [        5         gf = f)z™
When a generator reraises a different exception, creating a L{Failure}
above the generator should find the reraised exception rather than
original one.
c               3  ó@   #   •  S v •  g ! [          a    / S      g f = f7frò  )r-   r   r   r   rá  ÚLExtendedGeneratorTests.test_ambiguousFailureFromGenerator.<locals>.generatorÿ  s"   é € ðÜøÜ ó Ø�1”ðüs   ‚„	 ˆ‰˜š›Nrä  )	rå  r1   rÜ  r-   r  r   r.   rJ   ró  rõ  s       r   Ú"test_ambiguousFailureFromGeneratorÚ9ExtendedGeneratorTests.test_ambiguousFailureFromGeneratorø  sa   € ô	ñ ‹KˆÜˆQŒÜÓ ˆð	GØ×$Ñ$ QÕ*øÜó 	GØ×!Ñ!¤'§/¢/Ó"3×"9Ñ"9¼:ÖFð	Gús   £5 µ=A5Á4A5r   N)r0   r)  rÛ  zGenerator[Any, Any, Any]r    r'  r&  )r"   r#   r$   r%   r&   rÜ  ræ  rî  rö  rû  r'   r   r   r   r×  r×  —  s?   † ñðYØ ðYØ%=ðYà	ôYôMô2"8ôH'÷*Gr   r×  )r)   r!   r    r)  )
re  r(  r‡   r�  rf  r(  rg  r'  r    r   ),r&   Ú
__future__r   r�   r¾  r  r‚   rÀ   r¾   Údisr   Úior   r   Útypesr   Útypingr	   r
   r   Úunittestr   Úcython_test_exception_raiserr   Útwisted.pythonr   r   Útwisted.trial.unittestr   r½   r   r1   r3   r+  r<   r2  r6  r9  r]  rh  rj  r{  r»  r×  r   r   r   Ú<module>r     sí   ðñõ #ã Û 
Û Û 	Û 
Û Ý Ý Ý "Ý ß 'Ñ 'Ý å /ç +Ý 6ô
˜)ô 
ð /4÷ ô"`/Ð&ô `/ôF�	ô ô@˜tô @ô˜)Ð/Gò ôC(Ð+ô C(ôL>Ð*ô >ô2*ô1
Ð 3ô 1
ôhQ=Ð-ô Q=ôh3'Ð(ô 3'ôltGÐ0õ tGr   