Ë
    oj{= ã                  ó¤  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddlmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z* dd	lm+Z+ dd
l,m-Z-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZC ddlDm	Z	 	 	 	 	 d?d„ZE G d„ deF«      ZGd@d„ZHdAd„ZI e deF¬«      ZJ G d„ d«      ZK G d„ de	j˜                  «      ZM G d„ de	jœ                  eK«      ZO G d„ d«      ZPdBd „ZQ G d!„ d"e	jœ                  «      ZR G d#„ d$e	jœ                  «      ZS G d%„ d&e	jœ                  «      ZT G d'„ d(e	jœ                  «      ZU G d)„ d*e	jœ                  «      ZV G d+„ d,e	jœ                  «      ZW G d-„ d.e	jœ                  eK«      ZX G d/„ d0e	j˜                  «      ZYdCd1„ZZ G d2„ d3e	jœ                  «      Z[ G d4„ d5e	j˜                  «      Z\ G d6„ d7e	j˜                  eK«      Z]dDd8„Z^ G d9„ d:e	j˜                  «      Z_ G d;„ d<e	j˜                  «      Z` G d=„ d>e	jœ                  «      Zay)Ez+
Test cases for L{twisted.internet.defer}.
é    )ÚannotationsN)ÚAbstractEventLoopÚCancelledErrorÚFutureÚnew_event_loop)ÚAnyÚCallableÚ	CoroutineÚDictÚ	GeneratorÚListÚMappingÚNoReturnÚOptionalÚSetÚTupleÚTypeÚTypeVarÚUnionÚcast)Úassert_thatÚemptyÚequal_to)Úgiven)Úintegers)Úassert_type)ÚdeferÚreactor)Ú_TÚDeferredÚDeferredFilesystemLockÚDeferredListÚDeferredLockÚDeferredQueueÚDeferredSemaphoreÚFailureGroupÚ_DeferredListResultListTÚ_DeferredListSingleResultTÚensureDeferredÚrace)ÚClock)Úlog)Ú_PYPY©ÚFailure)Úunittestc                óD   ‡ — t        j                  ‰ «      dˆ fd„«       }|S )Nc                 ó>   •—  ‰| i |¤Ž}t        j                  |«      S ©N)r    ÚfromCoroutine)ÚargsÚkwargsÚcoroÚfs      €ú9/usr/lib/python3/dist-packages/twisted/test/test_defer.pyÚwrapperz!ensuringDeferred.<locals>.wrapperI   s#   ø€ á�$Ð!˜&Ñ!ˆÜ×%Ñ% dÓ+Ð+ó    )r5   Úobjectr6   r<   ÚreturnzDeferred[_T])Ú	functoolsÚwraps)r8   r:   s   ` r9   ÚensuringDeferredr@   F   s'   ø€ ô ‡_�_�QÓô,ó ð,ð €Nr;   c                  ó   — e Zd Zy)ÚGenericErrorN©Ú__name__Ú
__module__Ú__qualname__© r;   r9   rB   rB   Q   s   „ Ør;   rB   c                 óH   — 	 ddz   S # t         $ r t        | i |¤Ž}Y |S w xY w)zÂ
    Make a L{Failure} of a divide-by-zero error.

    @param args: Any C{*args} are passed to Failure's constructor.
    @param kwargs: Any C{**kwargs} are passed to Failure's constructor.
    é   r   )ÚBaseExceptionr/   )r5   r6   r8   s      r9   ÚgetDivisionFailurerK   U   s:   € ð%Ø	ˆAŠð €Høô ò %Ü�TÐ$˜VÑ$‰Ø€Hð%ús   ‚	 ‰! !c                ó&   — | j                  d«       y)z­
    A fake L{Deferred} canceller which callbacks the L{Deferred}
    with C{str} "Callback Result" when cancelling it.

    @param deferred: The cancelled L{Deferred}.
    úCallback ResultN©Úcallback©Údeferreds    r9   ÚfakeCallbackCancellerrR   c   s   € ð ×ÑÐ'Õ(r;   Ú_ExceptionT)Úboundc                  ó$   — e Zd ZdZ	 	 	 	 	 	 dd„Zy)ÚImmediateFailureMixinz+
    Add additional assertion methods.
    c                ó&  — t        t        j                  | «      }g }|j                  |j                  «       |j                  t        |«      d«       |j                  |d   j                  |«      «       t        t        |d   j                  «      S )z¨
        Assert that the given Deferred current result is a Failure with the
        given exception.

        @return: The exception instance in the Deferred.
        rI   r   )r   r0   ÚTestCaseÚ
addErrbackÚappendÚassertEqualÚlenÚ
assertTrueÚcheckrS   Úvalue)ÚselfrQ   Ú	exceptionÚtestCaseÚfailuress        r9   ÚassertImmediateFailurez,ImmediateFailureMixin.assertImmediateFailureu   su   € ô œ×)Ñ)¨4Ó0ˆØ"$ˆØ×Ñ˜HŸO™OÔ,Ø×ÑœS ›]¨AÔ.Ø×Ñ˜H Q™K×-Ñ-¨iÓ8Ô9Ü”K ¨!¡×!2Ñ!2Ó3Ð3r;   N)rQ   úDeferred[Any]ra   zType[_ExceptionT]r=   rS   )rD   rE   rF   Ú__doc__rd   rG   r;   r9   rV   rV   p   s$   „ ñð4Ø%ð4Ø2Cð4à	ô4r;   rV   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)Ú	UtilTestsz&
    Tests for utility functions.
    c                ó¢   — t        t        «       «      }t        j                  |«      }| j	                  t        «       | j                  ||«       y)z<
        L{defer.logError} returns the given error.
        N)r/   ÚRuntimeErrorr   ÚlogErrorÚflushLoggedErrorsÚassertIs)r`   ÚerrorÚresults      r9   Útest_logErrorReturnsErrorz#UtilTests.test_logErrorReturnsError‹   s:   € ô œ›Ó'ˆÜ—‘ Ó&ˆØ×Ñœ|Ô,à�‰�e˜VÕ$r;   c                ó¤   — t        t        «       «      }t        j                  |«       | j	                  t        «      }| j                  ||g«       y)z9
        L{defer.logError} logs the given error.
        N)r/   rj   r   rk   rl   r[   )r`   rn   Úerrorss      r9   Útest_logErrorLogsErrorz UtilTests.test_logErrorLogsError•   s>   € ô œ›Ó'ˆÜ�‰�uÔØ×'Ñ'¬Ó5ˆà×Ñ˜ % Õ)r;   c                ó   ‡— g Šdˆfd„}t        j                  |«       t        t        «       «      }t	        j
                  |«       | j                  t        «       | j                  ‰d   j                  d«      «       y)zR
        The text logged by L{defer.logError} has no repr of the failure.
        c                óZ   •— t        j                  | «      }|€J ‚‰j                  |«       y r3   )r,   ÚtextFromEventDictrZ   )Ú	eventDictÚtextÚoutputs     €r9   Úemitz4UtilTests.test_logErrorLogsErrorNoRepr.<locals>.emit¥   s+   ø€ Ü×(Ñ(¨Ó3ˆDØÐ#Ð#Ð#Ø�M‰M˜$Õr;   r   úUnhandled Error
Traceback N)rw   zDict[str, Any]r=   ÚNone)	r,   ÚaddObserverr/   rj   r   rk   rl   r]   Ú
startswith)r`   rz   rn   ry   s      @r9   Útest_logErrorLogsErrorNoReprz&UtilTests.test_logErrorLogsErrorNoReprŸ   s_   ø€ ð ˆõ	 ô
 	�‰˜Ôäœ›Ó'ˆÜ�‰�uÔØ×Ñœ|Ô,à�‰˜˜q™	×,Ñ,Ð-JÓKÕLr;   N©r=   r|   )rD   rE   rF   rf   rp   rs   r   rG   r;   r9   rh   rh   †   s   „ ñó%ó*ôMr;   rh   c                  ó0  — e Zd ZdWd„ZdXd„ZdYd„ZdZd„ZdWd„ZdWd„ZdWd„Z	dWd„Z
dWd	„ZdWd
„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„ZdWd„Z dWd„Z!dWd „Z"dWd!„Z#dWd"„Z$dWd#„Z%dWd$„Z&dWd%„Z'dWd&„Z(dWd'„Z)dWd(„Z*dWd)„Z+dWd*„Z,dWd+„Z-dWd,„Z.dWd-„Z/dWd.„Z0dWd/„Z1dWd0„Z2dWd1„Z3dWd2„Z4dWd3„Z5dWd4„Z6dWd5„Z7dWd6„Z8dWd7„Z9dWd8„Z:dWd9„Z;dWd:„Z<dWd;„Z=dWd<„Z>dWd=„Z?dWd>„Z@dWd?„ZAdWd@„ZBdWdA„ZCdWdB„ZDdWdC„ZEdWdD„ZFdWdE„ZGdWdF„ZHdWdG„ZIdWdH„ZJdWdI„ZKdWdJ„ZLdWdK„ZMdWdL„ZNdWdM„ZOdWdN„ZPdWdO„ZQdWdP„ZRdWdQ„ZS eTjª                  eVdR«      dWdS„«       ZW eTjª                  eVdR«      dWdT„«       ZX eTjª                  eVdR«      dWdU„«       ZYyV)[ÚDeferredTestsc                ó’   — d | _         d | _        d | _        | j                  t        j
                  t	        j                  «       «       y r3   )ÚcallbackResultsÚcallback2ResultsÚerrbackResultsÚ
addCleanupr   ÚsetDebuggingÚgetDebugging©r`   s    r9   ÚsetUpzDeferredTests.setUp´   sH   € ð ð 	Ôð
 ð 	Ôð
 ð 	Ôð
 	�‰œ×*Ñ*¬E×,>Ñ,>Ó,@ÕAr;   c                ó   — ||f| _         |d   S ©Nr   ©r„   ©r`   r5   r6   s      r9   Ú	_callbackzDeferredTests._callbackÂ   s   € Ø# V˜|ˆÔØ�A‰wˆr;   c                ó   — ||f| _         y r3   ©r…   r�   s      r9   Ú
_callback2zDeferredTests._callback2Æ   s   € Ø $ f ˆÕr;   c                ó   — ||f| _         y r3   ©r†   r�   s      r9   Ú_errbackzDeferredTests._errbackÉ   s   € Ø" F˜lˆÕr;   c                óâ   — t        «       }|j                  | j                  «       |j                  d«       | j	                  | j
                  «       | j                  | j                  di f«       y ©NÚhello©r™   ©r    ÚaddCallbackr�   rO   ÚassertIsNoner†   r[   r„   ©r`   rQ   s     r9   ÚtestCallbackWithoutArgsz%DeferredTests.testCallbackWithoutArgsÌ   sX   € Ü"*£*ˆØ×Ñ˜TŸ^™^Ô,Ø×Ñ˜'Ô"Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-°
¸BÐ/?Õ@r;   c                óä   — t        «       }|j                  | j                  d«       |j                  d«       | j	                  | j
                  «       | j                  | j                  di f«       y )NÚworldr™   )r™   r¡   r›   rž   s     r9   ÚtestCallbackWithArgsz"DeferredTests.testCallbackWithArgsÓ   s[   € Ü"*£*ˆØ×Ñ˜TŸ^™^¨WÔ5Ø×Ñ˜'Ô"Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-Ð0BÀBÐ/GÕHr;   c                óê   — t        «       }|j                  | j                  d¬«       |j                  d«       | j	                  | j
                  «       | j                  | j                  dddif«       y )Nr¡   )r¡   r™   rš   r›   rž   s     r9   ÚtestCallbackWithKwArgsz$DeferredTests.testCallbackWithKwArgsÚ   sb   € Ü"*£*ˆØ×Ñ˜TŸ^™^°7ÐÔ;Ø×Ñ˜'Ô"Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-°
¸WÀgÐ<NÐ/OÕPr;   c                óT  — t        «       }|j                  | j                  «       |j                  | j                  «       |j	                  d«       | j                  | j                  «       | j                  | j                  di f«       | j                  | j                  di f«       y r˜   )
r    rœ   r�   r“   rO   r�   r†   r[   r„   r…   rž   s     r9   ÚtestTwoCallbackszDeferredTests.testTwoCallbacksá   s…   € Ü"*£*ˆØ×Ñ˜TŸ^™^Ô,Ø×Ñ˜TŸ_™_Ô-Ø×Ñ˜'Ô"Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-°
¸BÐ/?Ô@Ø×Ñ˜×.Ñ.°¸RÐ0@ÕAr;   c                ó$  — t        d«      }t        «       }|j                  | j                  t	        t
        dt        f   d«      «       |j                  |«       |j                  | j                  «       | j                  | j                  «       | j                  €J ‚| j                  t        | j                  d   «      d«       | j                  | j                  d   d   j                  |«       | j                  | j                  d   i «       y)zQ
        If given None for an errback, addCallbacks uses a pass-through.
        Úoopsie.Nr   rI   )rB   r    ÚaddCallbacksr�   r   r	   r<   ÚerrbackrY   r–   r�   r„   r†   r[   r\   r_   ©r`   rn   rQ   s      r9   Útest_addCallbacksNoneErrbackz*DeferredTests.test_addCallbacksNoneErrbackê   sà   € ô ˜XÓ&ˆÜ#+£:ˆØ×Ñ˜dŸn™n¬d´8¸CÄ¸KÑ3HÈ$Ó.OÔPØ×Ñ˜ÔØ×Ñ˜DŸM™MÔ*Ø×Ñ˜$×.Ñ.Ô/Ø×"Ñ"Ð.Ð.Ð.Ø×Ñœ˜T×0Ñ0°Ñ3Ó4°aÔ8Ø×Ñ˜×,Ñ,¨QÑ/°Ñ2×8Ñ8¸%Ô@Ø×Ñ˜×,Ñ,¨QÑ/°Õ4r;   c           
     ó`  — t        «       }|j                  | j                  | j                  t	        t
        t           d«      t	        t        t        t        f   d«      di «       |j                  d«       | j                  | j                  «       | j                  | j                  di f«       y)zR
        If given None as a callback args and kwargs, () and {} are used.
        NrG   r™   rš   )r    r©   r�   r–   r   r   r<   r   ÚstrrO   r�   r†   r[   r„   rž   s     r9   Ú!test_addCallbacksNoneCallbackArgsz/DeferredTests.test_addCallbacksNoneCallbackArgsù   s�   € ô #+£*ˆØ×ÑØ�N‰NØ�M‰MÜ””v‘ Ó%Ü”œœf˜Ñ% tÓ,ØØô	
ð 	×Ñ˜'Ô"Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-°
¸BÐ/?Õ@r;   c                ór  — t        d«      }t        «       }|j                  | j                  | j                  di t        t        t           d«      t        t        t        t        f   d«      «       |j                  |«       |j                  | j                  «       | j                  | j                  «       | j                  €J ‚| j                  t!        | j                  d   «      d«       | j                  | j                  d   d   j"                  |«       | j                  | j                  d   i «       y)zQ
        If given None as a errback args and kwargs, () and {} are used.
        r¨   rG   Nr   rI   )rB   r    r©   r�   r–   r   r   r<   r   r®   rª   rY   r�   r„   r†   r[   r\   r_   r«   s      r9   Ú test_addCallbacksNoneErrbackArgsz.DeferredTests.test_addCallbacksNoneErrbackArgs
  s  € ô ˜XÓ&ˆÜ#+£:ˆØ×ÑØ�N‰NØ�M‰MØØÜ””v‘ Ó%Ü”œœf˜Ñ% tÓ,ô	
ð 	×Ñ˜ÔØ×Ñ˜DŸM™MÔ*Ø×Ñ˜$×.Ñ.Ô/Ø×"Ñ"Ð.Ð.Ð.Ø×Ñœ˜T×0Ñ0°Ñ3Ó4°aÔ8Ø×Ñ˜×,Ñ,¨QÑ/°Ñ2×8Ñ8¸%Ô@Ø×Ñ˜×,Ñ,¨QÑ/°Õ4r;   c                óz  — t         t        t        t        t        t
        f   f      }t        «       }t        «       }t        «       }t        |||g«      }g }|fd	d„}d
d„}|j                  ||«       |j                  d«       |j                  |«       |j                  t        d«      «       |j                  d«       | j                  |d   |d   d   t	        t        t
        |d   d   «      j                  «      f|d   gt         j"                  dft         j$                  dft         j"                  dfg«       y )Nc                ó&   — |j                  | «       y r3   )Úextend©Ú
resultListro   s     r9   Úcbz*DeferredTests.testDeferredList.<locals>.cb)  s   € Ø�M‰M˜*Õ%r;   c                 ó   — y r3   rG   ©Úerrs    r9   Úcatchz-DeferredTests.testDeferredList.<locals>.catch,  ó   € Ør;   Ú1Ú2Ú3r   rI   é   )r¶   Ú
ResultListro   rÁ   r=   r|   ©rº   r/   r=   r|   )r   r   Úboolr   r®   r/   r    r"   r©   rO   rY   rª   rB   r[   r   r_   r   ÚSUCCESSÚFAILURE)	r`   rÁ   Údefr1Údefr2Údefr3Údlro   r·   r»   s	            r9   ÚtestDeferredListzDeferredTests.testDeferredList   s  € Üœ%¤¤e¬C´¨LÑ&9Ð 9Ñ:Ñ;ˆ
ä'›zˆÜ'›zˆÜ'›zˆÜ˜5 %¨Ð/Ó0ˆØˆà<Bô 	&ó	ð 	�‰˜˜BÔØ�‰�sÔØ×Ñ˜Ôð 	�‰”l 3Ó'Ô(Ø�‰�sÔØ×Ñà�q‘	à˜‘˜1‘œs¤4¬°¸±¸1±Ó#>×#DÑ#DÓEÐFØ�q‘	ð	ô �m‰m˜SÐ!¤E§M¡M°3Ð#7¼%¿-¹-ÈÐ9MÐNõ	
r;   c                óæ   — g }|f	 	 	 	 	 dd„}t        g «      }|j                  |«       | j                  |g g«       g |d d  t        g d¬«      }|j                  |«       | j                  |g «       y )Nc                ó&   — |j                  | «       y r3   ©rZ   rµ   s     r9   r·   z/DeferredTests.testEmptyDeferredList.<locals>.cbG  s   € ð �M‰M˜*Õ%r;   T©ÚfireOnOneCallback)r¶   z_DeferredListResultListT[None]ro   z$List[_DeferredListResultListT[None]]r=   r|   )r"   r©   r[   )r`   ro   r·   Údl1Údl2s        r9   ÚtestEmptyDeferredListz#DeferredTests.testEmptyDeferredListD  s‘   € Ø79ˆð <Bð	&Ø6ð	&à8ð	&ð ó	&ô 9EÀRÓ8HˆØ×Ñ˜ÔØ×Ñ˜ " Ô&àˆ‰qˆ	Ü:FØ $ô;
ˆð 	×Ñ˜ÔØ×Ñ˜ Õ$r;   c                ó  — t        «       }t        «       }t        «       }t        |||gd¬«      }g }|j                  |j                  «       d
d„}|j                  |«       |j	                  d«       | j                  |g «       |j                  t        d«      «       | j                  t        |«      d«       |d   }| j                  t        |j                  t        j                  «      d|j                  ›�«       |j                  }| j                  |j                  j                  t        «       | j                  |j                  j                  j                   d	«       | j                  |j"                  d«       y )NT©ÚfireOnOneErrbackc                 ó   — y r3   rG   r¹   s    r9   r»   z;DeferredTests.testDeferredListFireOnOneError.<locals>.catchb  r¼   r;   r½   ú	from def2rI   r   zFissubclass(aFailure.type, defer.FirstError) failed: failure's type is )r×   rÂ   )r    r"   rY   rZ   rO   r[   rª   rB   r\   r]   Ú
issubclassÚtyper   Ú
FirstErrorr_   Ú
subFailurer5   Úindex)	r`   rÆ   rÇ   rÈ   rÉ   ro   r»   ÚaFailureÚ
firstErrors	            r9   ÚtestDeferredListFireOnOneErrorz,DeferredTests.testDeferredListFireOnOneErrorX  s3  € Ü'›zˆÜ'›zˆÜ'›zˆÜ˜5 %¨Ð/À$ÔGˆØ "ˆØ
�‰�f—m‘mÔ$ó	ð 	×Ñ˜Ôð 	�‰�sÔØ×Ñ˜ Ô$ð 	�‰”l ;Ó/Ô0Ø×Ñœ˜V› aÔ(ð ˜!‘9ˆð 	�‰Ü�x—}‘}¤e×&6Ñ&6Ô7à&.§m¢mð6ô	
ð —^‘^ˆ
ð 	×Ñ˜×.Ñ.×3Ñ3´\ÔBØ×Ñ˜×.Ñ.×4Ñ4×9Ñ9¸>ÔJØ×Ñ˜×)Ñ)¨1Õ-r;   c                óÖ  — t        «       }t        |g«      }g }|j                  |j                  «       g }|j	                  |j                  «       |j                  t        d«      «       | j                  d|d   j                  j                  d   «       | j                  dt        |«      «       |d   d   }|€J ‚| j                  d|d   j                  j                  d   «       y )NÚBangr   rI   )r    r"   rY   rZ   rœ   rª   rB   r[   r_   r5   r\   ©r`   Úd1rÉ   Ú	errorTrapÚresultListsÚfirstResults         r9   Ú!testDeferredListDontConsumeErrorsz/DeferredTests.testDeferredListDontConsumeErrors�  sÍ   € Ü%›ZˆÜ˜2˜$Óˆà#%ˆ	Ø
�‰�i×&Ñ&Ô'à<>ˆØ
�‰�{×)Ñ)Ô*à
�
‰
”< Ó'Ô(Ø×Ñ˜ ¨1¡×!3Ñ!3×!8Ñ!8¸Ñ!;Ô<Ø×Ñ˜œC Ó,Ô-Ø! !‘n QÑ'ˆØÐ&Ð&Ð&Ø×Ñ˜ ¨Q¡×!5Ñ!5×!:Ñ!:¸1Ñ!=Õ>r;   c                ó¦  — t        «       }t        |gd¬«      }g }|j                  |j                  «       g }|j	                  |j                  «       |j                  t        d«      «       | j                  g |«       | j                  dt        |«      «       |d   d   }|€J ‚| j                  d|d   j                  j                  d   «       y )NT©ÚconsumeErrorsrá   rI   r   )r    r"   rY   rZ   rœ   rª   rB   r[   r\   r_   r5   râ   s         r9   ÚtestDeferredListConsumeErrorsz+DeferredTests.testDeferredListConsumeErrors’  sº   € Ü%›ZˆÜ˜2˜$¨dÔ3ˆà#%ˆ	Ø
�‰�i×&Ñ&Ô'à<>ˆØ
�‰�{×)Ñ)Ô*à
�
‰
”< Ó'Ô(Ø×Ñ˜˜YÔ'Ø×Ñ˜œC Ó,Ô-Ø! !‘n QÑ'ˆØÐ&Ð&Ð&Ø×Ñ˜ ¨Q¡×!5Ñ!5×!:Ñ!:¸1Ñ!=Õ>r;   c                ó  — t        «       }t        «       }|j                  t        d«      «       t        ||gd¬«      }g }|j	                  |j
                  «       | j                  dt        |«      «       |j	                  d„ «       y )Nrá   TrÔ   rI   c                 ó   — y r3   rG   ©Úes    r9   ú<lambda>zWDeferredTests.testDeferredListFireOnOneErrorWithAlreadyFiredDeferreds.<locals>.<lambda>¯  ó   � r;   )r    rª   rB   r"   rY   rZ   r[   r\   ©r`   rã   Úd2rÉ   ro   s        r9   Ú7testDeferredListFireOnOneErrorWithAlreadyFiredDeferredszEDeferredTests.testDeferredListFireOnOneErrorWithAlreadyFiredDeferreds£  sh   € ä%›ZˆÜ%›ZˆØ
�
‰
”< Ó'Ô(ô ˜2˜r˜(°TÔ:ˆØ "ˆØ
�‰�f—m‘mÔ$Ø×Ñ˜œC ›KÔ(à
�‰‘nÕ%r;   c                ó0  — t        «       }t        «       }|j                  t        d«      «       |j                  d«       t	        ||g«      }g }|j                  |j                  «       | j                  dt        |«      «       |j                  d„ «       y )Nrá   rÀ   rI   c                 ó   — y r3   rG   rî   s    r9   rð   zIDeferredTests.testDeferredListWithAlreadyFiredDeferreds.<locals>.<lambda>À  rñ   r;   )
r    rª   rB   rO   r"   rœ   rZ   r[   r\   rY   rò   s        r9   Ú)testDeferredListWithAlreadyFiredDeferredsz7DeferredTests.testDeferredListWithAlreadyFiredDeferreds±  sq   € ä$›JˆÜ$›JˆØ
�
‰
”< Ó'Ô(Ø
�‰�AŒô ˜2˜r˜(Ó#ˆà/1ˆØ
�‰�v—}‘}Ô%à×Ñ˜œC ›KÔ(à
�‰‘nÕ%r;   c                óæ   — t        «       }t        «       }t        ||g«      }|j                  «        | j                  |t        j
                  «       | j                  |t        j
                  «       y)zk
        When cancelling an unfired L{DeferredList}, cancel every
        L{Deferred} in the list.
        N©r    r"   ÚcancelÚfailureResultOfr   r   ©r`   ÚdeferredOneÚdeferredTwoÚdeferredLists       r9   Útest_cancelDeferredListz%DeferredTests.test_cancelDeferredListÂ  sY   € ô
 '/£jˆÜ&.£jˆÜ# [°+Ð$>Ó?ˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜[¬%×*>Ñ*>Õ?r;   c                óÆ  — t        t        «      }t        «       }t        ||g«      }|j                  «        | j	                  |t
        j                  «       | j                  |«      }| j                  |d   d   «       | j                  |d   d   d«       | j                  |d   d   «       | j                  |d   d   j                  t
        j                  «      «       y)zì
        When cancelling an unfired L{DeferredList} without the
        C{fireOnOneCallback} and C{fireOnOneErrback} flags set, the
        L{DeferredList} will be callback with a C{list} of
        (success, result) C{tuple}s.
        r   rI   rM   N)r    rR   r"   rú   rû   r   r   ÚsuccessResultOfr]   r[   ÚassertFalser^   ©r`   rý   rþ   rÿ   ro   s        r9   Útest_cancelDeferredListCallbackz-DeferredTests.test_cancelDeferredListCallbackÎ  s¿   € ô &.Ô.CÓ%DˆÜ%-£ZˆÜ# [°+Ð$>Ó?ˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×%Ñ% lÓ3ˆØ�‰˜˜q™	 !™Ô%Ø×Ñ˜ ™ 1™Ð'8Ô9Ø×Ñ˜ ™ 1™Ô&Ø�‰˜˜q™	 !™×*Ñ*¬5×+?Ñ+?Ó@ÕAr;   c                óê   — t        «       }t        «       }t        ||gd¬«      }|j                  «        | j                  |t        j
                  «       | j                  |t        j
                  «       y)z’
        When cancelling an unfired L{DeferredList} with the flag
        C{fireOnOneCallback} set, cancel every L{Deferred} in the list.
        TrÎ   Nrù   rü   s       r9   Ú,test_cancelDeferredListWithFireOnOneCallbackz:DeferredTests.test_cancelDeferredListWithFireOnOneCallbackà  s\   € ô
 '/£jˆÜ&.£jˆÜ# [°+Ð$>ÐRVÔWˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜[¬%×*>Ñ*>Õ?r;   c                óú   — t        t        «      }t        «       }t        ||gd¬«      }|j                  «        | j	                  |t
        j                  «       | j                  |«      }| j                  |d«       y)a  
        When cancelling an unfired L{DeferredList} with the flag
        C{fireOnOneCallback} set, if one of the L{Deferred} callbacks
        in its canceller, the L{DeferredList} will callback with the
        result and the index of the L{Deferred} in a C{tuple}.
        TrÎ   )rM   r   N)	r    rR   r"   rú   rû   r   r   r  r[   r  s        r9   Ú?test_cancelDeferredListWithFireOnOneCallbackAndDeferredCallbackzMDeferredTests.test_cancelDeferredListWithFireOnOneCallbackAndDeferredCallbackì  sk   € ô &.Ô.CÓ%DˆÜ%-£ZˆÜ# [°+Ð$>ÐRVÔWˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×%Ñ% lÓ3ˆØ×Ñ˜Ð!7Õ8r;   c                ó²  — t        «       }t        «       }t        ||gd¬«      }|j                  «        | j                  |t        j
                  «       | j                  |t        j
                  «       | j                  |t        j                  «      }|j                  }| j                  |j                  j                  t        j
                  «      «       y)z‘
        When cancelling an unfired L{DeferredList} with the flag
        C{fireOnOneErrback} set, cancel every L{Deferred} in the list.
        TrÔ   N)r    r"   rú   rû   r   r   rÚ   r_   r]   rÛ   r^   )r`   rý   rþ   rÿ   ÚdeferredListFailurerÞ   s         r9   Ú+test_cancelDeferredListWithFireOnOneErrbackz9DeferredTests.test_cancelDeferredListWithFireOnOneErrbackû  s£   € ô
 '/£jˆÜ&.£jˆÜ# [°+Ð$>ÐQUÔVˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜[¬%×*>Ñ*>Ô?Ø"×2Ñ2°<Ä×AQÑAQÓRÐØ(×.Ñ.ˆ
Ø�‰˜
×-Ñ-×3Ñ3´E×4HÑ4HÓIÕJr;   c                ó\  — t        t        «      }t        t        «      }t        ||gd¬«      }|j                  «        | j	                  |«      }| j                  |d   d   «       | j                  |d   d   d«       | j                  |d   d   «       | j                  |d   d   d«       y)zÿ
        When cancelling an unfired L{DeferredList} with the flag
        C{fireOnOneErrback} set, if all the L{Deferred} callbacks
        in its canceller, the L{DeferredList} will callback with a
        C{list} of (success, result) C{tuple}s.
        TrÔ   r   rI   rM   N)r    rR   r"   rú   r  r]   r[   r  s        r9   Ú?test_cancelDeferredListWithFireOnOneErrbackAllDeferredsCallbackzMDeferredTests.test_cancelDeferredListWithFireOnOneErrbackAllDeferredsCallback
  s¢   € ô &.Ô.CÓ%DˆÜ%-Ô.CÓ%DˆÜ# [°+Ð$>ÐQUÔVˆØ×ÑÔØ×%Ñ% lÓ3ˆØ�‰˜˜q™	 !™Ô%Ø×Ñ˜ ™ 1™Ð'8Ô9Ø�‰˜˜q™	 !™Ô%Ø×Ñ˜ ™ 1™Ð'8Õ9r;   c                óB  — t        «       }t        «       }||g}t        |«      }t        «       }|j                  |«       |j                  «        | j	                  |t
        j                  «       | j	                  |t
        j                  «       | j                  |«       y)zg
        Cancelling a L{DeferredList} will cancel the original
        L{Deferred}s passed in.
        N)r    r"   rZ   rú   rû   r   r   ÚassertNoResult)r`   rý   rþ   ÚargumentListrÿ   ÚdeferredThrees         r9   Ú,test_cancelDeferredListWithOriginalDeferredsz:DeferredTests.test_cancelDeferredListWithOriginalDeferreds  s�   € ô
 '/£jˆÜ&.£jˆØ# [Ð1ˆÜ# LÓ1ˆÜ(0«
ˆØ×Ñ˜MÔ*Ø×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜MÕ*r;   c                ó  — dd„}t        |«      }t        «       }t        ||g«      }|j                  «        | j                  |t        j
                  «       | j                  t        «      }| j                  t        |«      d«       y)z®
        Cancelling a L{DeferredList} will cancel every L{Deferred}
        in the list even exceptions raised from the C{cancel} method of the
        L{Deferred}s.
        c                ó   — t        d«      ‚)z„
            A L{Deferred} canceller that raises an exception.

            @param deferred: The cancelled L{Deferred}.
            Útest)rj   rP   s    r9   ÚcancellerRaisesExceptionzTDeferredTests.test_cancelDeferredListWithException.<locals>.cancellerRaisesException2  s   € ô ˜vÓ&Ð&r;   rI   N)rQ   úDeferred[object]r=   r|   )
r    r"   rú   rû   r   r   rl   rj   r[   r\   )r`   r  rý   rþ   rÿ   rr   s         r9   Ú$test_cancelDeferredListWithExceptionz2DeferredTests.test_cancelDeferredListWithException+  sp   € ó	'ô '/Ð/GÓ&HˆÜ&.£jˆÜ# [°+Ð$>Ó?ˆØ×ÑÔØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×'Ñ'¬Ó5ˆØ×Ñœ˜V› aÕ(r;   c                ó®   — t        «       }t        «       }t        ||gd¬«      }|j                  d«       |j                  «        | j	                  |«       y)zÜ
        When a L{DeferredList} has fired because one L{Deferred} in
        the list fired with a non-failure result, the cancellation will do
        nothing instead of cancelling the rest of the L{Deferred}s.
        TrÎ   N)r    r"   rO   rú   r  rü   s       r9   Ú)test_cancelFiredOnOneCallbackDeferredListz7DeferredTests.test_cancelFiredOnOneCallbackDeferredListB  sL   € ô '/£jˆÜ&.£jˆÜ# [°+Ð$>ÐRVÔWˆØ×Ñ˜TÔ"Ø×ÑÔØ×Ñ˜KÕ(r;   c                ó,  — t        «       }t        «       }t        ||gd¬«      }|j                  t        d«      «       |j	                  «        | j                  |«       | j                  |t        «       | j                  |t        j                  «       y)zØ
        When a L{DeferredList} has fired because one L{Deferred} in
        the list fired with a failure result, the cancellation will do
        nothing instead of cancelling the rest of the L{Deferred}s.
        TrÔ   r  N)	r    r"   rª   rB   rú   r  rû   r   rÚ   rü   s       r9   Ú(test_cancelFiredOnOneErrbackDeferredListz6DeferredTests.test_cancelFiredOnOneErrbackDeferredListO  sw   € ô '/£jˆÜ&.£jˆÜ# [°+Ð$>ÐQUÔVˆØ×ÑœL¨Ó0Ô1Ø×ÑÔØ×Ñ˜KÔ(Ø×Ñ˜[¬,Ô7Ø×Ñ˜\¬5×+;Ñ+;Õ<r;   c                óŽ   — g }t        j                  d«      }|j                  |j                  «       | j	                  |dg«       y )NÚsuccess)r   Úsucceedrœ   rZ   r[   ©r`   ÚlÚds      r9   ÚtestImmediateSuccessz"DeferredTests.testImmediateSuccess^  s7   € ØˆÜ Ÿ=™=¨Ó3ˆØ	�‰�a—h‘hÔØ×Ñ˜˜Y˜KÕ(r;   c                óÊ   — g }t        j                  t        d«      «      }|j                  |j                  «       | j                  t        |d   j                  «      d«       y ©NÚfailr   )r   r'  rB   rY   rZ   r[   r®   r_   r!  s      r9   ÚtestImmediateFailurez"DeferredTests.testImmediateFailured  sF   € ØˆÜ!ŸJ™J¤|°FÓ';Ó<ˆØ	�‰�Q—X‘XÔØ×Ñœ˜Q˜q™TŸZ™Z›¨&Õ1r;   c                ó.  — g }t        j                  t        d«      «      }|j                  «        |j	                  |j
                  «       | j                  |g «       |j                  «        | j                  t        |d   j                  «      d«       y r&  )
r   r'  rB   ÚpauserY   rZ   r[   Úunpauser®   r_   r!  s      r9   ÚtestPausedFailurezDeferredTests.testPausedFailurej  sh   € ØˆÜ�J‰J”| FÓ+Ó,ˆØ	�‰Œ	Ø	�‰�Q—X‘XÔØ×Ñ˜˜BÔØ	�	‰	ŒØ×Ñœ˜Q˜q™TŸZ™Z›¨&Õ1r;   c                ó¾  — g }t        «       }|j                  d„ «      j                  |j                  «       |j	                  d«       | j                  |d   j                  t        «       g }t        t           «       }|j                  d„ «      j                  |j                  «       |j	                  d«       | j                  |d   j                  t        «       y )Nc                ó   — ddz  S ©NrI   r   rG   ©Ú_s    r9   rð   z2DeferredTests.testCallbackErrors.<locals>.<lambda>v  s
   €   Q¡€ r;   rI   r   c                ó(   — t        t        «       «      S r3   )r/   ÚZeroDivisionErrorr0  s    r9   rð   z2DeferredTests.testCallbackErrors.<locals>.<lambda>{  s   € ¤Ô):Ó)<Ó!=€ r;   )	r    rœ   rY   rZ   rO   ÚassertIsInstancer_   r3  Úint)r`   r"  r#  ró   s       r9   ÚtestCallbackErrorsz DeferredTests.testCallbackErrorss  sž   € ØˆÜ#›:ˆØ	�‰Ñ&Ó'×2Ñ2°1·8±8Ô<Ø	�
‰
�1ŒØ×Ñ˜a ™dŸj™jÔ*;Ô<ØˆÜ”c‰]‹_ˆØ
�‰Ñ=Ó>×IÑIÈ!Ï(É(ÔSØ
�‰�AŒØ×Ñ˜a ™dŸj™jÔ*;Õ<r;   c                óŽ   — t        «       }|j                  «        |j                  | j                  «       |j	                  «        y r3   )r    r*  rœ   r�   r+  ©r`   r#  s     r9   ÚtestUnpauseBeforeCallbackz'DeferredTests.testUnpauseBeforeCallback  s+   € Ü$›JˆØ	�‰Œ	Ø	�‰�d—n‘nÔ%Ø	�	‰	�r;   c                óV  ‡— t        «       }t        «       Š‰j                  «        |j                  ˆfd„«       |j                  | j                  «       |j	                  d«       | j                  | j                  d«       ‰j	                  d«       | j                  | j                  d«       ‰j                  «        | j                  | j                  d«       | j                  €J d«       ‚| j                  | j                  d	   d	   dd
j                  | j                  «      «       y)z›
        Callbacks passed to L{Deferred.addCallback} can return Deferreds and
        the next callback will not be run until that Deferred fires.
        c                ó   •— ‰S r3   rG   )Úrró   s    €r9   rð   z<DeferredTests.test_callbackReturnsDeferred.<locals>.<lambda>�  s   ø€  € r;   rI   z Should not have been called yet.rÀ   z&Still should not have been called yet.zShould have been called nowNz%make that legible to the type checkerr   z/Result should have been from second deferred:{})r    r*  rœ   r�   rO   r�   r„   r+  ÚassertIsNotNoneÚassertEqualsÚformat©r`   rã   ró   s     @r9   Útest_callbackReturnsDeferredz*DeferredTests.test_callbackReturnsDeferred…  sô   ø€ ô
 %›JˆÜ$›JˆØ
�‰Œ
Ø
�‰“|Ô$Ø
�‰�t—~‘~Ô&Ø
�‰�AŒØ×Ñ˜$×.Ñ.Ð0RÔSØ
�‰�AŒØ×ÑØ× Ñ Ð"Jô	
ð 	�
‰
ŒØ×Ñ˜T×1Ñ1Ð3PÔQØ×#Ñ#Ð/ÐXÐ1XÓXÐ/Ø×ÑØ× Ñ  Ñ# AÑ&ØØ=×DÑDØ×$Ñ$óõ	
r;   c                ó¨  ‡‡— t        «       }dŠt        «       Šdˆˆfd„}|j                  d«       | j                  | j	                  |j                  |«      «      d«       t        t           «       }dŠ|j                  d«       | j                  | j                  |j                  |«      j                  |«      t        «      j                  ‰«       y)zF
        Callbacks passed to addCallback may return Failures.
        Fc                ó(   •— ‰rt        ‰«      S | dz   S ©NrI   r.   )ro   ÚrteÚ
shouldFails    €€r9   Ú	maybeFailzADeferredTests.test_callbackMaybeReturnsFailure.<locals>.maybeFail©  s   ø€ áÜ˜s“|Ð#à ‘zÐ!r;   é   é   TN)ro   r5  r=   zUnion[int, Failure])
r    rj   rO   r[   r  rœ   r5  rm   rû   r_   )r`   r#  rG  rE  rF  s      @@r9   Ú test_callbackMaybeReturnsFailurez.DeferredTests.test_callbackMaybeReturnsFailure   s§   ù€ ô $›:ˆàˆ
Ü‹nˆö	"ð 	
�
‰
�1ŒØ×Ñ˜×-Ñ-¨a¯m©m¸IÓ.FÓGÈÔKÜ”S‰M‹OˆØˆ
Ø	�
‰
�1ŒØ�‰Ø× Ñ à—‘˜iÓ(×4Ñ4°YÓ?Üó÷ ‰eØõ	
r;   c                óL  ‡‡— t        «       }t        «       Šg Šdˆfd„}dˆfd„}|j                  |«      j                  |«       |j                  t	        «       «       | j                  |«       | j                  ‰g «       ‰j                  d«       | j                  ‰dg«       y)zo
        Errbacks passed to L{Deferred.addErrback} can return Deferreds just as
        callbacks can.
        ro   c                ó   •— ‰S r3   rG   )ro   ró   s    €r9   ÚasyncErrbackz?DeferredTests.test_errbackReturnsDeferred.<locals>.asyncErrbackÇ  s   ø€ ØˆIr;   c                ó(   •— ‰j                  | «       y r3   rÍ   )ro   ÚresultValuess    €r9   ÚsyncCallbackz?DeferredTests.test_errbackReturnsDeferred.<locals>.syncCallbackÊ  s   ø€ Ø×Ñ Õ'r;   N)ro   r/   r=   úDeferred[str])ro   zUnion[str, int]r=   r|   )r    rY   rœ   rª   Ú
ValueErrorr  r[   rO   )r`   r#  rM  rP  ró   rO  s       @@r9   Útest_errbackReturnsDeferredz)DeferredTests.test_errbackReturnsDeferred¾  s…   ù€ ô
 $›:ˆÜ$›JˆØˆõ	õ	(ð 	
�‰�\Ó"×.Ñ.¨|Ô<Ø	�	‰	”*“,ÔØ×Ñ˜AÔØ×Ñ˜ rÔ*Ø
�‰�HÔØ×Ñ˜¨ zÕ2r;   c                ór  ‡— t        «       }t        «       Š‰j                  |«       ‰j                  «        t        «       }|j	                  ˆfd„«       |j                  d«       g }|j	                  |j
                  «       | j                  |g «       ‰j                  «        | j                  ||g«       y)zÃ
        When a paused Deferred with a result is returned from a callback on
        another Deferred, the other Deferred is chained to the first and waits
        for it to be unpaused.
        c                ó   •— ‰S r3   rG   )ÚignoredÚpauseds    €r9   rð   zDDeferredTests.test_chainedPausedDeferredWithResult.<locals>.<lambda>ß  s   ø€ ¨F€ r;   N)r<   r    rO   r*  rœ   rZ   r[   r+  )r`   ÚexpectedÚchainedro   rW  s       @r9   Ú$test_chainedPausedDeferredWithResultz2DeferredTests.test_chainedPausedDeferredWithResultÔ  s�   ø€ ô “8ˆÜ#+£:ˆØ�‰˜Ô!Ø�‰ŒÜ"*£*ˆØ×ÑÓ2Ô3Ø×Ñ˜Ôà!ˆØ×Ñ˜FŸM™MÔ*Ø×Ñ˜ Ô$Ø�‰ÔØ×Ñ˜ ( Õ,r;   c                ó  ‡— t        «       }t        «       Š|j                  ˆfd„«       |j                  d«       |j                  «        ‰j                  d«       g }‰j                  |j                  «       | j                  |dg«       y)z½
        A paused Deferred encountered while pushing a result forward through a
        chain does not prevent earlier Deferreds from continuing to execute
        their callbacks.
        c                ó   •— ‰S r3   rG   ©rV  Úseconds    €r9   rð   z:DeferredTests.test_pausedDeferredChained.<locals>.<lambda>ð  ó   ø€ ¨&€ r;   N)r    rœ   rO   r*  rZ   r[   )r`   Úfirstro   r^  s      @r9   Útest_pausedDeferredChainedz(DeferredTests.test_pausedDeferredChainedè  sl   ø€ ô !)£
ˆÜ!)£ˆØ×ÑÓ0Ô1Ø�‰�tÔØ�‰ŒØ�‰˜ÔØˆØ×Ñ˜6Ÿ=™=Ô)Ø×Ñ˜ $ Õ(r;   c                ó4  — g }t        j                  t        j                  d«      t        j                  d«      g«      j                  |j                  «       | j                  |ddgg«       g }t        j                  d«      t        j                  t        «       «      g}t        j                  |«      j                  |j                  «       | j                  t        |«      d«       | j                  |d   t        «       |d   j                  d„ «       y )NrI   rÀ   r   c                 ó   — yrD  rG   rî   s    r9   rð   z2DeferredTests.test_gatherResults.<locals>.<lambda>  rñ   r;   )r   ÚgatherResultsr   rœ   rZ   r[   r'  rR  rY   r\   r4  r/   )r`   Úresultsrr   rÉ   s       r9   Útest_gatherResultsz DeferredTests.test_gatherResultsø  sÐ   € à#%ˆÜ×ÑœUŸ]™]¨1Ó-¬u¯}©}¸QÓ/?Ð@ÓA×MÑMØ�N‰Nô	
ð 	×Ñ˜ A q 6 (Ô+à "ˆÜ�m‰m˜AÓ¤§
¡
¬:«<Ó 8Ð9ˆÜ×Ñ˜BÓ×*Ñ*¨6¯=©=Ô9Ø×Ñœ˜V› aÔ(Ø×Ñ˜f Q™i¬Ô1à
ˆ1‰×Ñ™Õ%r;   c                ó(  — t        j                  d«      }t        j                  t        d«      «      }t        j                  ||gd¬«      }g }|j                  |j                  «       g }|j                  |j                  «       | j                  t        |«      t        |«      fd«       | j                  |d   j                  t         j                  «       |d   j                  j                  }| j                  |j                  t        «       y)zÒ
        If a L{Deferred} in the list passed to L{gatherResults} fires with a
        failure and C{consumerErrors} is C{True}, the failure is converted to a
        L{None} result on that L{Deferred}.
        rI   zoh noesTré   ©r   rI   r   N)r   r   r'  rj   rd  rY   rZ   r[   r\   r4  r_   rÚ   rÛ   )r`   ÚdgoodÚdbadr#  ÚunconsumedErrorsÚgatheredErrorsrÞ   s          r9   Ú#test_gatherResultsWithConsumeErrorsz1DeferredTests.test_gatherResultsWithConsumeErrors  sØ   € ô —‘˜aÓ ˆÜ�z‰zœ, yÓ1Ó2ˆÜ×Ñ ¨ ¸TÔBˆØ*,ÐØ�‰Ð(×/Ñ/Ô0Ø(*ˆØ	�‰�^×*Ñ*Ô+à×Ñœ#Ð.Ó/´°^Ó1DÐEÀvÔNØ×Ñ˜n¨QÑ/×5Ñ5´u×7GÑ7GÔHØ# AÑ&×,Ñ,×7Ñ7ˆ
Ø×Ñ˜j×.Ñ.´Õ=r;   c                óÂ  — t        «       }t        «       }t        j                  ||g«      }|j                  «        | j	                  |t        j
                  «       | j	                  |t        j
                  «       | j	                  |t        j                  «      }|j                  }| j                  |j                  j                  t        j
                  «      «       y)z~
        When cancelling the L{defer.gatherResults} call, all the
        L{Deferred}s in the list will be cancelled.
        N)r    r   rd  rú   rû   r   rÚ   r_   r]   rÛ   r^   )r`   rý   rþ   ro   ÚgatherResultsFailurerÞ   s         r9   Útest_cancelGatherResultsz&DeferredTests.test_cancelGatherResults  s£   € ô
 '/£jˆÜ&.£jˆÜ×$Ñ$ k°;Ð%?Ó@ˆØ�‰ŒØ×Ñ˜[¬%×*>Ñ*>Ô?Ø×Ñ˜[¬%×*>Ñ*>Ô?Ø#×3Ñ3°F¼E×<LÑ<LÓMÐØ)×/Ñ/ˆ
Ø�‰˜
×-Ñ-×3Ñ3´E×4HÑ4HÓIÕJr;   c                ó  — t        t        «      }t        t        «      }t        j                  ||g«      }|j	                  «        | j                  |«      }| j                  |d   d«       | j                  |d   d«       y)zö
        When cancelling the L{defer.gatherResults} call, if all the
        L{Deferred}s callback in their canceller, the L{Deferred}
        returned by L{defer.gatherResults} will be callbacked with the C{list}
        of the results.
        r   rM   rI   N)r    rR   r   rd  rú   r  r[   )r`   rý   rþ   ro   ÚcallbackResults        r9   Ú0test_cancelGatherResultsWithAllDeferredsCallbackz>DeferredTests.test_cancelGatherResultsWithAllDeferredsCallback+  st   € ô &.Ô.CÓ%DˆÜ%-Ô.CÓ%DˆÜ×$Ñ$ k°;Ð%?Ó@ˆØ�‰ŒØ×-Ñ-¨fÓ5ˆØ×Ñ˜¨Ñ*Ð,=Ô>Ø×Ñ˜¨Ñ*Ð,=Õ>r;   c                ó"  ‡— t        «       Šg }g }t        j                  ˆfd„«      }|j                  |j                  |j                  «       | j                  |g «       | j                  t        |«      d«       | j                  |d   ‰«       y)z�
        L{defer.maybeDeferred} should retrieve the result of a synchronous
        function and pass it to its resulting L{Deferred}.
        c                 ó   •— ‰ S r3   rG   ©ro   s   €r9   rð   z6DeferredTests.test_maybeDeferredSync.<locals>.<lambda>B  s   ø€ ¨€ r;   rI   r   N)r<   r   ÚmaybeDeferredr©   rZ   r[   r\   ÚassertIdentical)r`   re  rr   r#  ro   s       @r9   Útest_maybeDeferredSyncz$DeferredTests.test_maybeDeferredSync:  st   ø€ ô
 “ˆØ "ˆØ "ˆÜ×Ñ£Ó/ˆØ	�‰�w—~‘~ v§}¡}Ô5Ø×Ñ˜ Ô$Ø×Ñœ˜W› qÔ)Ø×Ñ˜W Q™Z¨Õ0r;   c                ó  — dd„}g }g }t        j                  |d«      }t        |t        t           «       |j                  |j                  |j                  «       | j                  |g «       | j                  |dg«       y)zV
        L{defer.maybeDeferred} should pass arguments to the called function.
        c                ó   — | dz   S )Né   rG   ©Úxs    r9   ÚplusFivez>DeferredTests.test_maybeDeferredSyncWithArgs.<locals>.plusFiveM  s   € Ø�q‘5ˆLr;   é
   é   N)r~  r5  r=   r5  )r   rw  r   r    r5  r©   rZ   r[   )r`   r  re  rr   r#  s        r9   Útest_maybeDeferredSyncWithArgsz,DeferredTests.test_maybeDeferredSyncWithArgsH  sk   € ó
	ð  ˆØ "ˆÜ×Ñ ¨"Ó-ˆÜ�A”x¤‘}Ô%Ø	�‰�w—~‘~ v§}¡}Ô5Ø×Ñ˜ Ô$Ø×Ñ˜ 2 $Õ'r;   c                ó^  ‡— t        d«      Šdˆfd„}g }g }t        j                  |«      j                  |j                  |j                  «       | j                  |g «       | j                  t        |«      d«       | j                  t        |d   j                  «      t        ‰«      «       y)zš
        L{defer.maybeDeferred} should catch an exception raised by a synchronous
        function and errback its resulting L{Deferred} with it.
        zthat value is unacceptablec                 ó   •— ‰ ‚r3   rG   ©rX  s   €r9   ÚraisesExceptionzFDeferredTests.test_maybeDeferredSyncException.<locals>.raisesException_  s   ø€ ØˆNr;   rI   r   N)r=   r   )	rR  r   rw  r©   rZ   r[   r\   r®   r_   )r`   r†  re  rr   rX  s       @r9   Útest_maybeDeferredSyncExceptionz-DeferredTests.test_maybeDeferredSyncExceptionX  s‰   ø€ ô
 Ð:Ó;ˆõ	ð  ˆØ "ˆÜ×Ñ˜OÓ,×9Ñ9¸'¿.¹.È&Ï-É-ÔXØ×Ñ˜ "Ô%Ø×Ñœ˜V› aÔ(Ø×Ñœ˜V A™YŸ_™_Ó-¬s°8«}Õ=r;   c                óL  ‡— 	 ddz    g }g }t        j                  ˆfd„«      }|j	                  |j
                  |j
                  «       | j                  |g «       | j                  t        |«      d«       | j                  |d   ‰«       y# t         $ r t        «       ŠY Œšw xY w)zw
        L{defer.maybeDeferred} should handle a L{Failure} returned by a
        function and errback with it.
        Ú10r|  c                 ó   •— ‰ S r3   rG   r…  s   €r9   rð   z=DeferredTests.test_maybeDeferredSyncFailure.<locals>.<lambda>u  s   ø€ ¨€ r;   rI   r   N)	Ú	TypeErrorr/   r   rw  r©   rZ   r[   r\   rx  )r`   re  rr   r#  rX  s       @r9   Útest_maybeDeferredSyncFailurez+DeferredTests.test_maybeDeferredSyncFailurei  s’   ø€ ð
	!Ø�1ŠHð  ˆØ "ˆÜ×ÑÓ 0Ó1ˆØ	�‰�w—~‘~ v§}¡}Ô5Ø×Ñ˜ "Ô%Ø×Ñœ˜V› aÔ(Ø×Ñ˜V A™Y¨Õ1øô ò 	!Ü“yŠHð	!ús   ƒB ÂB#Â"B#c                óÌ   ‡— t        «       Št        j                  ˆfd„«      }‰j                  d«       g }|j	                  |j
                  «       | j                  |dg«       y)z}
        L{defer.maybeDeferred} should let L{Deferred} instance pass by
        so that original result is the same.
        c                 ó   •— ‰ S r3   rG   ©rã   s   €r9   rð   z7DeferredTests.test_maybeDeferredAsync.<locals>.<lambda>�  s   ø€ ¨€ r;   ÚSuccessN)r    r   rw  rO   rœ   rZ   r[   )r`   ró   ro   rã   s      @r9   Útest_maybeDeferredAsyncz%DeferredTests.test_maybeDeferredAsync{  sO   ø€ ô
 %›JˆÜ× Ñ £Ó,ˆØ
�‰�IÔØˆØ
�‰�v—}‘}Ô%Ø×Ñ˜ ) Õ-r;   c                óº   ‡— t        «       Št        j                  ˆfd„«      }‰j                  t	        t        «       «      «       | j                  |t
        «       y)z¢
        L{defer.maybeDeferred} should let L{Deferred} instance pass by
        so that L{Failure} returned by the original instance is the
        same.
        c                 ó   •— ‰ S r3   rG   r�  s   €r9   rð   z<DeferredTests.test_maybeDeferredAsyncError.<locals>.<lambda>Ž  s   ø€ ¸€ r;   N)r    r   rw  rª   r/   rj   rd   )r`   ró   rã   s     @r9   Útest_maybeDeferredAsyncErrorz*DeferredTests.test_maybeDeferredAsyncError‡  s?   ø€ ô &›ZˆÜ"×0Ñ0³Ó<ˆØ
�
‰
”7œ<›>Ó*Ô+Ø×#Ñ# B¬Õ5r;   c                ó¦   — dd„}t        j                  |«      }t        |t        t           «       | j                  | j                  |«      d«       y)ú¿
        When called with a coroutine function L{defer.maybeDeferred} returns a
        L{defer.Deferred} which has the same result as the coroutine returned
        by the function.
        c               “  ó   K  — y­w©NrI  rG   rG   r;   r9   r8   z;DeferredTests.test_maybeDeferredCoroutineSuccess.<locals>.f™  ó	   è ø€ Øùó   ‚rI  N©r=   r5  )r   rw  r   r    r5  r[   r  )r`   r8   ÚcoroutineDeferreds      r9   Ú"test_maybeDeferredCoroutineSuccessz0DeferredTests.test_maybeDeferredCoroutineSuccess’  sE   € ó	ô "×/Ñ/°Ó2ÐÜÐ%¤x´¡}Ô5Ø×Ñ˜×-Ñ-Ð.?Ó@À!ÕDr;   c                óÞ   ‡— dd„Šdˆfd„}dd„}t        j                  |«      }t        |t        t           «       |j                  |«      }| j                  | j                  |«      d«       y)	r–  c               “  ó   K  — y­wr˜  rG   rG   r;   r9   r8   zCDeferredTests.test_maybeDeferredCoroutineSuccessIndirect.<locals>.f§  r™  rš  c                 ó   •—  ‰ «       S r3   rG   ©r8   s   €r9   ÚgzCDeferredTests.test_maybeDeferredCoroutineSuccessIndirect.<locals>.g¬  ó
   ø€ Ù“3ˆJr;   c                ó   — | dz   S rD  rG   rv  s    r9   ÚtypedCallbackzODeferredTests.test_maybeDeferredCoroutineSuccessIndirect.<locals>.typedCallback±  s   € Ø˜A‘:Ðr;   é   Nr›  )r=   z"Coroutine[Deferred[int], Any, Any])ro   r5  r=   r5  )r   rw  r   r    r   rœ   r[   r  )r`   r¢  r¥  rœ  ÚmodifiedDeferredr8   s        @r9   Ú*test_maybeDeferredCoroutineSuccessIndirectz8DeferredTests.test_maybeDeferredCoroutineSuccessIndirect   sa   ø€ ó	õ
	ó
	ô "×/Ñ/°Ó2ÐÜÐ%¤x´¡}Ô5Ø,×8Ñ8¸ÓGÐØ×Ñ˜×-Ñ-Ð.>Ó?ÀÕCr;   c                óÀ   ‡‡—  G d„ dt         «      Šdˆfd„Šdˆfd„}t        | j                  t        j                  |«      «      j
                  t        ‰«      «       y)zÑ
        When called with a coroutine function L{defer.maybeDeferred} returns a
        L{defer.Deferred} which has a L{Failure} result wrapping the exception
        raised by the coroutine function.
        c                  ó   — e Zd Zy)úGDeferredTests.test_maybeDeferredCoroutineFailure.<locals>.SomeExceptionNrC   rG   r;   r9   ÚSomeExceptionr«  À  s   „ Ør;   r¬  c               “  ó   •K  —  ‰ «       ‚­wr3   rG   )r¬  s   €r9   r8   z;DeferredTests.test_maybeDeferredCoroutineFailure.<locals>.fÃ  s   øè ø€ Ù“/Ð!ùs   ƒc                 ó   •—  ‰ «       S r3   rG   r¡  s   €r9   r¢  z;DeferredTests.test_maybeDeferredCoroutineFailure.<locals>.gÈ  r£  r;   Nr€   )r=   zCoroutine[None, None, None])Ú	Exceptionr   rû   r   rw  rÙ   r   )r`   r¢  r¬  r8   s     @@r9   Ú"test_maybeDeferredCoroutineFailurez0DeferredTests.test_maybeDeferredCoroutineFailure¹  sJ   ù€ ô	œIô 	õ	"õ
	ô 	Ø× Ñ ¤×!4Ñ!4°QÓ!7Ó8×=Ñ=Ü�]Ó#õ	
r;   c                ó’  ‡‡‡— g Šg Št        «       Šdˆˆˆfd„}t        j                  d«      }|j                  |«       ‰j	                  d«       |j                  ‰j
                  «       ‰j                  ‰j
                  «       |j                  ‰j
                  «       | j                  g ‰«       | j                  ‰g d¢«       y)a  
        When a L{Deferred} encounters a result which is another L{Deferred}
        which is waiting on a third L{Deferred}, the middle L{Deferred}'s
        callbacks are executed after the third L{Deferred} fires and before the
        first receives a result.
        c                óè   •— ‰j                  d| f«       t        j                  d«      }dˆˆfd„}dˆfd„}|j                  |«      j                  |«       |j	                  ‰j                   «       |S )Nústart-of-cbÚinnerc                ó*   •— ‰j                  d«       ‰S ©N©ÚfirstCallbackr´  rÍ   ©ro   r´  re  s    €€r9   r¸  zMDeferredTests.test_innerCallbacksPreserved.<locals>.cb.<locals>.firstCallbackß  s   ø€ Ø—‘Ð9Ô:Ø�r;   c                ó4   •— ‰j                  d| f«       | dz  S ©NÚsecondCallbackrÀ   rÍ   ©ro   re  s    €r9   r¼  zNDeferredTests.test_innerCallbacksPreserved.<locals>.cb.<locals>.secondCallbackã  ó   ø€ Ø—‘Ð 0°&Ð9Ô:Ø ‘zÐ!r;   ©ro   r®   r=   rQ  ©ro   r®   r=   r®   ©rZ   r   r   rœ   rY   ©ro   r#  r¸  r¼  rc   r´  re  s       €€€r9   r·   z6DeferredTests.test_innerCallbacksPreserved.<locals>.cbÛ  sZ   ø€ Ø�N‰N˜M¨6Ð2Ô3Ü—‘˜gÓ&ˆAöõ"ð �M‰M˜-Ó(×4Ñ4°^ÔDØ�L‰L˜Ÿ™Ô)ØˆHr;   ÚouterÚorange©©r³  rÃ  r·  )r¼  rÄ  ÚorangeorangeNr¿  )r    r   r   rœ   rO   rZ   rY   r[   ©r`   r·   rÃ  rc   r´  re  s      @@@r9   Útest_innerCallbacksPreservedz*DeferredTests.test_innerCallbacksPreservedÐ  s¡   ú€ ð 68ˆØ"$ˆÜ'›zˆ÷	ô  —‘˜gÓ&ˆØ×Ñ˜"ÔØ�‰�xÔ Ø×Ñ˜'Ÿ.™.Ô)Ø×Ñ˜Ÿ™Ô)Ø×Ñ˜Ÿ™Ô)Ø×Ñ˜˜XÔ&Ø×ÑØòõ	
r;   c                óN  ‡‡‡— g Šg Št        «       Šdˆˆˆfd„}t        j                  d«      j                  |«      j	                  ‰j
                  «       | j                  ddg‰«       ‰j                  d«       | j                  g ‰«       | j                  ‰ddddgfg«       y)	a   
        The continue callback of a L{Deferred} waiting for another L{Deferred}
        is not necessarily the first one. This is somewhat a whitebox test
        checking that we search for that callback among the whole list of
        callbacks.
        c                óð   •— ‰j                  d| f«       t        «       }dˆˆfd„}dˆfd„}|j                  |«      j                  |«      j                  ‰j                   «      }|j	                  d «       |S )Nr·   c                óV   •— ‰j                  d| f«       t        j                  ‰g«      S ©Nr¸  ©rZ   r   rd  ©ro   Úare  s    €€r9   r¸  zNDeferredTests.test_continueCallbackNotFirst.<locals>.cb.<locals>.firstCallback  ó'   ø€ Ø—‘ °Ð8Ô9Ü×*Ñ*¨A¨3Ó/Ð/r;   c                ó,   •— ‰j                  d| f«       y ©Nr¼  rÍ   r½  s    €r9   r¼  zODeferredTests.test_continueCallbackNotFirst.<locals>.cb.<locals>.secondCallback  ó   ø€ Ø—‘Ð 0°&Ð9Õ:r;   ©ro   r|   r=   úDeferred[List[str]]©ro   ú	List[str]r=   r|   ©rZ   r    rœ   rY   rO   ©ro   r#  r¸  r¼  ÚreturnerrÐ  rc   re  s        €€€r9   r·   z7DeferredTests.test_continueCallbackNotFirst.<locals>.cb  ób   ø€ Ø�N‰N˜D &˜>Ô*Ü (£
ˆAö0õ;ð —‘˜mÓ,ß‘˜^Ó,ß‘˜HŸO™OÓ,ð ð
 �J‰J�tÔØˆOr;   rÃ  ©r·   rÃ  ©r¸  NÚwithersr¼  N©ro   r®   r=   úDeferred[None])r    r   r   rœ   rY   rZ   r[   rO   )r`   r·   rÐ  rc   re  s     @@@r9   Útest_continueCallbackNotFirstz+DeferredTests.test_continueCallbackNotFirstü  s›   ú€ ð BDˆØ"$ˆÜ#›:ˆ÷	ô& 	�‰�gÓ×*Ñ*¨2Ó.×9Ñ9¸(¿/¹/ÔJØ×Ñ˜/Ð+BÐCÀWÔMØ	�
‰
�9ÔØ×Ñ˜˜XÔ&Ø×ÑØØÐ5Ð8HÈ9È+Ð7VÐWõ	
r;   c                óŒ  ‡‡‡— g Šg Št        «       Šd
ˆˆˆfd„}t        «       }|j                  |«       |j                  ˆfd„«       |j                  ‰j                  «       |j	                  d«       | j                  ddg‰«       ‰j	                  d«       | j                  g ‰«       | j                  ‰ddddgfdg«       y	)zÃ
        A callback added to a L{Deferred} after a previous callback attached
        another L{Deferred} as a result is run after the callbacks of the other
        L{Deferred} are run.
        c                óð   •— ‰j                  d| f«       t        «       }dˆˆfd„}dˆfd„}|j                  |«      j                  |«      j                  ‰j                   «      }|j	                  d «       |S )Nr·   c                óV   •— ‰j                  d| f«       t        j                  ‰g«      S rÍ  rÎ  rÏ  s    €€r9   r¸  zLDeferredTests.test_callbackOrderPreserved.<locals>.cb.<locals>.firstCallback1  rÑ  r;   c                ó,   •— ‰j                  d| f«       y rÓ  rÍ   r½  s    €r9   r¼  zMDeferredTests.test_callbackOrderPreserved.<locals>.cb.<locals>.secondCallback5  rÔ  r;   rÕ  r×  rÙ  rÚ  s        €€€r9   r·   z5DeferredTests.test_callbackOrderPreserved.<locals>.cb-  rÜ  r;   c                ó&   •— ‰j                  d«      S )N©ÚfinalNrÍ   )r~  re  s    €r9   rð   z;DeferredTests.test_callbackOrderPreserved.<locals>.<lambda>B  s   ø€  G§N¡N°?Ó$C€ r;   rÃ  rÝ  rÞ  rß  r¼  rè  Nrà  )r    rœ   rY   rZ   rO   r[   )r`   r·   rÃ  rÐ  rc   re  s      @@@r9   Útest_callbackOrderPreservedz)DeferredTests.test_callbackOrderPreserved#  s¼   ú€ ð BDˆØ"$ˆÜ#›:ˆ÷	ô&  (›zˆØ×Ñ˜"ÔØ×ÑÓCÔDØ×Ñ˜Ÿ™Ô)Ø�‰�wÔØ×Ñ˜/Ð+BÐCÀWÔMØ	�
‰
�9ÔØ×Ñ˜˜XÔ&Ø×ÑØàØ'Ø! I ;Ð/Øð	õ	
r;   c                óØ   ‡‡‡— t        «       Šg Šdˆfd„Šdˆfd„}dˆˆˆfd„}‰j                  |«       ‰j                  |«       ‰j                  d«       | j                  ‰g d¢«       y)z�
        A callback added to a L{Deferred} by a callback on that L{Deferred}
        should be added to the end of the callback chain.
        c                ó(   •— ‰j                  d«       y ©Né   rÍ   ©ro   Úcalleds    €r9   Ú	callback3z;DeferredTests.test_reentrantRunCallbacks.<locals>.callback3Z  ó   ø€ Ø�M‰M˜!Õr;   c                ó(   •— ‰j                  d«       y ©NrÀ   rÍ   rï  s    €r9   Ú	callback2z;DeferredTests.test_reentrantRunCallbacks.<locals>.callback2]  rò  r;   c                óJ   •— ‰j                  d«       ‰j                  ‰«       y rD  ©rZ   rœ   )ro   rñ  rð  rQ   s    €€€r9   Ú	callback1z;DeferredTests.test_reentrantRunCallbacks.<locals>.callback1`  s   ø€ Ø�M‰M˜!ÔØ× Ñ  Õ+r;   N)rI   rÀ   rî  ©ro   r|   r=   r|   ©r    rœ   rO   r[   )r`   rõ  rø  rñ  rð  rQ   s      @@@r9   Útest_reentrantRunCallbacksz(DeferredTests.test_reentrantRunCallbacksR  s\   ú€ ô
 $,£:ˆØˆõ	õ	÷	,ð 	×Ñ˜YÔ'Ø×Ñ˜YÔ'Ø×Ñ˜$ÔØ×Ñ˜¢Õ+r;   c                ó®   ‡ ‡‡‡— t        «       Šg Šdˆfd„Šdˆˆˆˆ fd„}‰j                  |«       ‰j                  d«       ‰ j                  ‰ddg«       y)z˜
        A callback added to a L{Deferred} by a callback on that L{Deferred}
        should not be executed until the running callback returns.
        c                ó(   •— ‰j                  d«       y rô  rÍ   rï  s    €r9   rõ  z;DeferredTests.test_nonReentrantCallbacks.<locals>.callback2q  rò  r;   c                óp   •— ‰j                  d«       ‰j                  ‰«       ‰j                  ‰dg«       y rD  )rZ   rœ   r[   )ro   rõ  rð  rQ   r`   s    €€€€r9   rø  z;DeferredTests.test_nonReentrantCallbacks.<locals>.callback1t  s/   ø€ Ø�M‰M˜!ÔØ× Ñ  Ô+Ø×Ñ˜V a SÕ)r;   NrI   rÀ   rù  rú  )r`   rø  rõ  rð  rQ   s   ` @@@r9   Útest_nonReentrantCallbacksz(DeferredTests.test_nonReentrantCallbacksi  sR   û€ ô
 $,£:ˆØˆõ	÷	*ð 	*ð
 	×Ñ˜YÔ'Ø×Ñ˜$ÔØ×Ñ˜ ! Q Õ(r;   c                óæ   ‡‡‡— dŠt        «       Šdˆfd„Šdˆˆfd„}‰j                  |«       ‰j                  d«       | j                  ‰t        «      }| j                  |j                  ‰f«       y)zé
        After an exception is raised by a callback which was added to a
        L{Deferred} by a callback on that L{Deferred}, the L{Deferred} should
        call the first errback with a L{Failure} wrapping that exception.
        zcallback raised exceptionc                ó   •— t        ‰«      ‚r3   ©r¯  )ro   ÚexceptionMessages    €r9   rõ  zFDeferredTests.test_reentrantRunCallbacksWithFailure.<locals>.callback2†  s   ø€ ÜÐ,Ó-Ð-r;   c                ó(   •— ‰j                  ‰«       y r3   )rœ   )ro   rõ  rQ   s    €€r9   rø  zFDeferredTests.test_reentrantRunCallbacksWithFailure.<locals>.callback1‰  s   ø€ Ø× Ñ  Õ+r;   N©ro   r<   r=   r|   )r    rœ   rO   rd   r¯  r[   r5   )r`   rø  ra   rõ  rQ   r  s      @@@r9   Ú%test_reentrantRunCallbacksWithFailurez3DeferredTests.test_reentrantRunCallbacksWithFailure}  sd   ú€ ð 7ÐÜ#+£:ˆõ	.ö	,ð 	×Ñ˜YÔ'Ø×Ñ˜$ÔØ×/Ñ/°¼)ÓDˆ	Ø×Ñ˜Ÿ™Ð*:Ð)<Õ=r;   c                ód  ‡— t        «       }t        j                  |«      Št        «       }|j	                  ˆfd„«       |j                  d«       g }‰j	                  |j                  «       | j                  |d   «       |j	                  |j                  «       | j                  |d   |«       y)a  
        If a first L{Deferred} with a result is returned from a callback on a
        second L{Deferred}, the result of the second L{Deferred} becomes the
        result of the first L{Deferred} and the result of the first L{Deferred}
        becomes L{None}.
        c                ó   •— ‰S r3   rG   ©Úignr`  s    €r9   rð   z=DeferredTests.test_synchronousImplicitChain.<locals>.<lambda>›  ó   ø€  u€ r;   Nr   rI   )	r<   r   r   r    rœ   rO   rZ   r�   rm   )r`   ro   r^  re  r`  s       @r9   Útest_synchronousImplicitChainz+DeferredTests.test_synchronousImplicitChain‘  s‰   ø€ ô “ˆÜ—‘˜fÓ%ˆÜ!)£ˆØ×ÑÓ,Ô-Ø�‰˜Ôà*,ˆØ×Ñ˜'Ÿ.™.Ô)Ø×Ñ˜' !™*Ô%Ø×Ñ˜7Ÿ>™>Ô*Ø�‰�g˜a‘j &Õ)r;   c                ó¶  ‡— t        «       Št        «       }|j                  ˆfd„«       |j                  d«       g }‰j                  |j                  «       g }|j                  |j                  «       | j	                  |g «       | j	                  |g «       t        «       }‰j                  |«       | j	                  |dg«       | j	                  ||g«       y)a9  
        If a first L{Deferred} without a result is returned from a callback on
        a second L{Deferred}, the result of the second L{Deferred} becomes the
        result of the first L{Deferred} as soon as the first L{Deferred} has
        one and the result of the first L{Deferred} becomes L{None}.
        c                ó   •— ‰S r3   rG   r	  s    €r9   rð   z>DeferredTests.test_asynchronousImplicitChain.<locals>.<lambda>­  r  r;   N)r    rœ   rO   rZ   r[   r<   )r`   r^  ræ   ÚsecondResultro   r`  s        @r9   Útest_asynchronousImplicitChainz,DeferredTests.test_asynchronousImplicitChain¤  s·   ø€ ô #+£*ˆÜ#+£:ˆØ×ÑÓ,Ô-Ø�‰˜Ôà$&ˆØ×Ñ˜+×,Ñ,Ô-Ø%'ˆØ×Ñ˜<×.Ñ.Ô/à×Ñ˜ bÔ)Ø×Ñ˜ rÔ*ä“ˆØ�‰�vÔà×Ñ˜ t fÔ-Ø×Ñ˜¨ xÕ0r;   c                ó2  — t        j                  t        d«      «      }|fdd„}t        «       }|j	                  |«       |j                  d«       g }|j	                  |j                  «       | j                  |d   «       | j                  |t        «       y)a  
        If a first L{Deferred} with a L{Failure} result is returned from a
        callback on a second L{Deferred}, the first L{Deferred}'s result is
        converted to L{None} and no unhandled error is logged when it is
        garbage collected.
        úFirst Deferred's Failurec                ó   — |S r3   rG   )r1  r`  s     r9   r·   z<DeferredTests.test_synchronousImplicitErrorChain.<locals>.cbÇ  s   € ØˆLr;   Nr   )r1  r|   r`  rá  r=   rá  )	r   r'  rj   r    rœ   rO   rZ   r�   rd   )r`   r`  r·   r^  ræ   s        r9   Ú"test_synchronousImplicitErrorChainz0DeferredTests.test_synchronousImplicitErrorChain¾  s~   € ô —
‘
œ<Ð(BÓCÓDˆà05ô 	ô "*£ˆØ×Ñ˜2ÔØ�‰˜ÔØ"$ˆØ×Ñ˜+×,Ñ,Ô-Ø×Ñ˜+ a™.Ô)Ø×#Ñ# F¬LÕ9r;   c                óL  ‡— t        «       Št        «       }|j                  ˆfd„«       |j                  d«       g }|j                  |j                  «       g }‰j                  |j                  «       g }|j                  |j                  «       | j                  |g «       | j                  |g «       ‰j                  t        d«      «       | j                  |d   j                  t        «      «       | j                  |dg«       | j                  t        |«      d«       y)aP  
        Let C{a} and C{b} be two L{Deferred}s.

        If C{a} has no result and is returned from a callback on C{b} then when
        C{a} fails, C{b}'s result becomes the L{Failure} that was C{a}'s result,
        the result of C{a} becomes L{None} so that no unhandled error is logged
        when it is garbage collected.
        c                ó   •— ‰S r3   rG   r	  s    €r9   rð   zCDeferredTests.test_asynchronousImplicitErrorChain.<locals>.<lambda>Ý  r  r;   Nr  r   rI   )r    rœ   rO   rY   rZ   r[   rª   rj   r]   r^   r\   )r`   r^  ÚsecondErrorræ   r  r`  s        @r9   Ú#test_asynchronousImplicitErrorChainz1DeferredTests.test_asynchronousImplicitErrorChainÒ  sí   ø€ ô !)£
ˆÜ!)£ˆØ×ÑÓ,Ô-Ø�‰˜ÔØ%'ˆØ×Ñ˜+×,Ñ,Ô-à"$ˆØ×Ñ˜+×,Ñ,Ô-Ø#%ˆØ×Ñ˜<×.Ñ.Ô/à×Ñ˜ bÔ)Ø×Ñ˜ rÔ*à�‰”lÐ#=Ó>Ô?Ø�‰˜ A™×,Ñ,¬\Ó:Ô;Ø×Ñ˜ t fÔ-Ø×Ñœ˜\Ó*¨AÕ.r;   c                ó’  ‡‡— t        «       Št        «       Š‰j                  ˆfd„«       t        «       }|j                  ˆfd„«       g }|j                  |j                  «       t        «       }‰j	                  d«       |j	                  d«       | j                  |g «       ‰j	                  |«       | j                  ||g«       y)zæ
        L{Deferred} chaining is transitive.

        In other words, let A, B, and C be Deferreds.  If C is returned from a
        callback on B and B is returned from a callback on A then when C fires,
        A fires.
        c                ó   •— ‰S r3   rG   r	  s    €r9   rð   zGDeferredTests.test_doubleAsynchronousImplicitChaining.<locals>.<lambda>ù  r  r;   c                ó   •— ‰S r3   rG   )r
  r^  s    €r9   rð   zGDeferredTests.test_doubleAsynchronousImplicitChaining.<locals>.<lambda>û  s   ø€  f€ r;   N)r    rœ   rZ   r<   rO   r[   )r`   ÚthirdÚthirdResultro   r`  r^  s       @@r9   Ú'test_doubleAsynchronousImplicitChainingz5DeferredTests.test_doubleAsynchronousImplicitChainingï  s¢   ù€ ô #+£*ˆÜ#+£:ˆØ×ÑÓ,Ô-Ü"*£*ˆØ×ÑÓ,Ô-à$&ˆØ×Ñ˜+×,Ñ,Ô-ä“ˆà�‰˜Ôà�‰�tÔð 	×Ñ˜ bÔ)ð 	�‰�vÔà×Ñ˜ v hÕ/r;   c                ó´  ‡‡‡— g Šg Št        «       Šd	ˆˆˆfd„}t        j                  d«      j                  |«      j                  ‰j                  «      }| j                  ‰ddg«       ‰j                  d«       ‰j                  ‰j                  «       |j                  ‰j                  «       | j                  g ‰d«       | j                  ‰g d¢«       y)
zÀ
        L{Deferred}s can have callbacks that themselves return L{Deferred}s.
        When these "inner" L{Deferred}s fire (even asynchronously), the
        callback chain continues.
        c                óè   •— ‰j                  d| f«       t        j                  d«      }dˆˆfd„}dˆfd„}|j                  |«      j                  |«       |j	                  ‰j                   «       |S )Nr³  r´  c                ó*   •— ‰j                  d«       ‰S r¶  rÍ   r¹  s    €€r9   r¸  zXDeferredTests.test_nestedAsynchronousChainedDeferreds.<locals>.cb.<locals>.firstCallback  s   ø€ Ø—‘Ð9Ô:ð �r;   c                ó4   •— ‰j                  d| f«       | dz  S r»  rÍ   r½  s    €r9   r¼  zYDeferredTests.test_nestedAsynchronousChainedDeferreds.<locals>.cb.<locals>.secondCallback$  r¾  r;   r¿  rÀ  rÁ  rÂ  s       €€€r9   r·   zADeferredTests.test_nestedAsynchronousChainedDeferreds.<locals>.cb  sZ   ø€ Ø�N‰N˜M¨6Ð2Ô3Ü—‘˜gÓ&ˆAöõ"ð �M‰M˜-Ó(×4Ñ4°^ÔDØ�L‰L˜Ÿ™Ô)ØˆHr;   rÃ  rÆ  r·  rÄ  ú&Got errbacks but wasn't expecting any.rÅ  Nr¿  ©r    r   r   rœ   rZ   r[   rO   rY   rÈ  s      @@@r9   Ú'test_nestedAsynchronousChainedDeferredsz5DeferredTests.test_nestedAsynchronousChainedDeferreds  sÃ   ú€ ð 68ˆØ"$ˆô  (›zˆ÷	ô, �M‰M˜'Ó"×.Ñ.¨rÓ2×>Ñ>¸w¿~¹~ÓNð 	ð
 	×ÑØÐ.Ð0JÐKô	
ð 	�‰�xÔ ð 	×Ñ˜Ÿ™Ô)Ø×Ñ˜Ÿ™Ô)Ø×Ñ˜˜XÐ'OÔPà×ÑØòõ	
r;   c                óÊ  ‡‡‡— g Šg Št        «       Šd	ˆˆˆfd„}t        j                  d«      }|j                  |«       |j                  ‰j                  «       | j                  ‰ddg«       ‰j                  d«       |j                  ‰j                  «       ‰j                  ‰j                  «       | j                  g ‰d«       | j                  ‰ddddgfddgg«       y)
aK  
        L{Deferred}s can have callbacks that themselves return L{Deferred}s.
        These L{Deferred}s can have other callbacks added before they are
        returned, which subtly changes the callback chain. When these "inner"
        L{Deferred}s fire (even asynchronously), the outer callback chain
        continues.
        c                óà   •— ‰j                  d| f«       t        j                  d«      }dˆˆfd„}dˆfd„}|j                  |«      j                  |«      j	                  ‰j                   «      S )Nr³  r´  c                óT   •— ‰j                  d| f«       dd„}‰j                  |«      S )Nr¸  c                ó   — | gS r3   rG   rv  s    r9   Ú	transformz}DeferredTests.test_nestedAsynchronousChainedDeferredsWithExtraCallbacks.<locals>.cb.<locals>.firstCallback.<locals>.transforme  s	   € Ø"˜8�Or;   )ro   r®   r=   rØ  r÷  )ro   r*  r´  re  s     €€r9   r¸  zjDeferredTests.test_nestedAsynchronousChainedDeferredsWithExtraCallbacks.<locals>.cb.<locals>.firstCallback^  s,   ø€ Ø—‘ °Ð8Ô9ó$ð ×(Ñ(¨Ó3Ð3r;   c                ó4   •— ‰j                  d| f«       | dz  S r»  rÍ   r½  s    €r9   r¼  zkDeferredTests.test_nestedAsynchronousChainedDeferredsWithExtraCallbacks.<locals>.cb.<locals>.secondCallbackj  r¾  r;   )ro   r®   r=   rÖ  )ro   rØ  r=   rØ  rÁ  rÂ  s       €€€r9   r·   zSDeferredTests.test_nestedAsynchronousChainedDeferredsWithExtraCallbacks.<locals>.cbZ  sW   ø€ Ø�N‰N˜M¨6Ð2Ô3Ü—‘˜gÓ&ˆAö
4õ"ð
 —‘˜mÓ,ß‘˜^Ó,ß‘˜HŸO™OÓ,ðr;   rÃ  rÆ  r·  rß  r#  r¼  N)ro   r®   r=   zDeferred[Optional[List[str]]]r$  rÈ  s      @@@r9   Ú9test_nestedAsynchronousChainedDeferredsWithExtraCallbackszGDeferredTests.test_nestedAsynchronousChainedDeferredsWithExtraCallbacksK  sÞ   ú€ ð  ˆØ"$ˆô  (›zˆ÷	ô: —‘˜gÓ&ˆØ×Ñ˜"ÔØ×Ñ˜'Ÿ.™.Ô)ð 	×ÑØÐ.Ð0JÐKô	
ð 	�‰�yÔ!ð 	×Ñ˜Ÿ™Ô)Ø×Ñ˜Ÿ™Ô)Ø×Ñ˜˜XÐ'OÔPà×ÑØà(Ø*Ø! I ;Ð/Ø˜IÐ&ð	õ	
r;   c                ó†   — t        «       }t        «       }|j                  |«       | j                  |j                  |«       y)zT
        When we chain a L{Deferred}, that chaining is recorded explicitly.
        N)r    ÚchainDeferredrm   Ú
_chainedTo©r`   rÐ  Úbs      r9   Ú&test_chainDeferredRecordsExplicitChainz4DeferredTests.test_chainDeferredRecordsExplicitChain“  s0   € ô %›JˆÜ$›JˆØ	�‰˜ÔØ�‰�a—l‘l AÕ&r;   c                ó¦   — t        «       }t        «       }|j                  |«       |j                  d«       | j                  |j                  «       y)aR  
        Any recorded chaining is cleared once the chaining is resolved, since
        it no longer exists.

        In other words, if one L{Deferred} is recorded as depending on the
        result of another, and I{that} L{Deferred} has fired, then the
        dependency is resolved and we no longer benefit from recording it.
        N)r    r.  rO   r�   r/  r0  s      r9   Ú%test_explicitChainClearedWhenResolvedz3DeferredTests.test_explicitChainClearedWhenResolvedœ  s<   € ô %›JˆÜ$›JˆØ	�‰˜ÔØ	�
‰
�4ÔØ×Ñ˜!Ÿ,™,Õ'r;   c                ó°   ‡— t        «       }t        «       Š|j                  ˆfd„«       |j                  d«       | j                  |j                  ‰«       y)zÍ
        We can chain L{Deferred}s implicitly by adding callbacks that return
        L{Deferred}s. When this chaining happens, we record it explicitly as
        soon as we can find out about it.
        c                ó   •— ‰S r3   rG   )rV  r1  s    €r9   rð   zFDeferredTests.test_chainDeferredRecordsImplicitChain.<locals>.<lambda>³  s   ø€  a€ r;   N)r    rœ   rO   rm   r/  r0  s     @r9   Ú&test_chainDeferredRecordsImplicitChainz4DeferredTests.test_chainDeferredRecordsImplicitChain«  s>   ø€ ô %›JˆÜ$›JˆØ	�‰Ó'Ô(Ø	�
‰
�4ÔØ�‰�a—l‘l AÕ&r;   c                ó|  ‡— t        «       Šd
ˆfd„}‰j                  |«       ‰j                  d«       | j                  |g«      }| j	                  t        |«      d«       |d   }| j	                  |d   t        «       d}| j                  t        j                  ||d   «      dj                  ||d   «      «       y	)z„
        When a Deferred is returned from a callback directly attached to that
        same Deferred, a warning is emitted.
        c                ó   •— ‰S r3   rG   ©ro   r#  s    €r9   ÚcircularCallbackzADeferredTests.test_circularChainWarning.<locals>.circularCallback¾  ó   ø€ ØˆHr;   ÚfoorI   r   Úcategoryz1Callback returned the Deferred it was attached toÚmessagez
Expected match: {!r}
Got: {!r}Nr¿  )r    rœ   rO   ÚflushWarningsr[   r\   ÚDeprecationWarningr]   ÚreÚsearchr?  )r`   r;  Úcircular_warningsÚwarningÚpatternr#  s        @r9   Útest_circularChainWarningz'DeferredTests.test_circularChainWarning·  s°   ø€ ô
 $›:ˆõ	ð 	
�‰Ð&Ô'Ø	�
‰
�5Ôà ×.Ñ.Ð0@Ð/AÓBÐØ×ÑœÐ.Ó/°Ô3Ø# AÑ&ˆØ×Ñ˜ Ñ,Ô.@ÔAØEˆØ�‰Ü�I‰I�g˜w yÑ1Ó2Ø/×6Ñ6°wÀÈ	Ñ@RÓSõ	
r;   c                ó@  ‡— | j                  t        t        dt        j                  «       t        j                  dt
        ¬«       t        «       Šdˆfd„}‰j                  |«       ‰j                  d«       | j                  ‰«      }|j                  t
        «       y)z¸
        If the deprecation warning for circular deferred callbacks is
        configured to be an error, the exception will become the failure
        result of the Deferred.
        Úfiltersrn   )r>  c                ó   •— ‰S r3   rG   r:  s    €r9   r;  zCDeferredTests.test_circularChainException.<locals>.circularCallbackÝ  r<  r;   r=  Nr¿  )r‡   ÚsetattrÚwarningsrI  ÚfilterwarningsrA  r    rœ   rO   rû   Útrap)r`   r;  Úfailurer#  s      @r9   Útest_circularChainExceptionz)DeferredTests.test_circularChainExceptionÎ  sz   ø€ ð 	�‰ÜÜØÜ×Ñô		
ô 	×Ñ Ô2DÕEÜ#›:ˆõ	ð 	
�‰Ð&Ô'Ø	�
‰
�5ÔØ×&Ñ& qÓ)ˆØ�‰Ô'Õ(r;   c                ón   — t        «       }t        |«      }| j                  t        |«      d|d›d�«       y)z€
        The C{repr()} of a L{Deferred} contains the class name and a
        representation of the internal Python ID.
        ú<Deferred at 0xr~  ú>N)r    Úidr[   Úrepr)r`   r#  Úaddresss      r9   Ú	test_reprzDeferredTests.test_reprå  s3   € ô
 %›JˆÜ�Q“%ˆØ×Ñœ˜a› O°G¸A°;¸aÐ"@ÕAr;   c                óŒ   — t        «       }|j                  d«       | j                  t        |«      dt	        |«      d›d�«       y)zb
        If a L{Deferred} has been fired, then its C{repr()} contains its
        result.
        rÄ  rR  r~  z current result: 'orange'>N)r    rO   r[   rU  rT  r8  s     r9   Útest_reprWithResultz!DeferredTests.test_reprWithResultî  s;   € ô
 $›:ˆØ	�
‰
�8ÔØ×Ñœ˜a› O´B°q³E¸!°9Ð<VÐ"WÕXr;   c           	     óº   — t        «       }t        «       }|j                  |«       | j                  t        |«      dt	        |«      d›dt	        |«      d›d�«       y)zÇ
        If a L{Deferred} C{a} has been fired, but is waiting on another
        L{Deferred} C{b} that appears in its callback chain, then C{repr(a)}
        says that it is waiting on C{b}.
        rR  r~  z waiting on Deferred at 0xrS  N)r    r.  r[   rU  rT  r0  s      r9   Útest_reprWithChainingz#DeferredTests.test_reprWithChaining÷  sR   € ô %›JˆÜ$›JˆØ	�‰˜ÔØ×ÑÜ�‹GØœb ›e A˜YÐ&@ÄÀAÃÀqÀ	ÈÐKõ	
r;   c                óN   ‡ — dˆ fd„}‰ j                   |d«       |d«      «       y)zw
        The depth of the call stack does not grow as more L{Deferred} instances
        are chained together.
        c                ó>  •‡
‡— g Šdˆfd„}t        «       }t        | «      D �cg c]  }t        «       ‘Œ }}|d d  }t        «       Š
|j                  «       }|f	 	 	 	 	 dd„}|j                  |«       |j                  |«       |r1|j                  «       }|f	 	 	 	 	 dd„}	|j                  |	«       |}|rŒ1|j                  ˆ
fd„«       |j	                  d «       |D ]  }|j	                  d «       Œ ‰j                  ‰g «       ‰
j	                  d «       ‰d   S c c}w )Nc                ó^   •— ‰j                  t        t        j                  «       «      «       y r3   )rZ   r\   Ú	tracebackÚextract_stack)rV  Ústacks    €r9   ÚrecordStackDepthzVDeferredTests.test_boundedStackDepth.<locals>.chainDeferreds.<locals>.recordStackDepth  s   ø€ Ø—‘œS¤×!8Ñ!8Ó!:Ó;Õ<r;   c                ó   — |S r3   rG   ©rV  r´  s     r9   ÚcbInnerzMDeferredTests.test_boundedStackDepth.<locals>.chainDeferreds.<locals>.cbInner  s	   € ð �r;   c                ó   — |S r3   rG   rd  s     r9   Ú
cbNewInnerzPDeferredTests.test_boundedStackDepth.<locals>.chainDeferreds.<locals>.cbNewInner%  s	   € ð !�Lr;   c                ó   •— ‰S r3   rG   )r
  Úlasts    €r9   rð   zNDeferredTests.test_boundedStackDepth.<locals>.chainDeferreds.<locals>.<lambda>-  s   ø€ ¨$€ r;   r   ©rV  r<   r=   r|   )rV  r<   r´  rá  r=   rá  )r    ÚrangeÚpoprœ   rO   r[   )ÚhowManyrb  ÚtoprV  ÚinnerDeferredsÚoriginalInnersr´  re  ÚnewInnerrg  ri  ra  r`   s             @@€r9   ÚchainDeferredsz<DeferredTests.test_boundedStackDepth.<locals>.chainDeferreds  sI  ú€ ØˆEõ=ô #+£*ˆCä*/°«.ö4Ø&”•
ð4ˆNð 4ð ,©AÐ.ˆNÜ#+£:ˆDà"×&Ñ&Ó(ˆEð :?ðØðØ(6ðàóð
 �O‰O˜GÔ$Ø�O‰OÐ,Ô-á Ø)×-Ñ-Ó/�ð >Fð!Ø#ð!Ø,:ð!à#ó!ð
 ×!Ñ! *Ô-Ø �ò !ð ×ÑÓ.Ô/à�L‰L˜ÔØ'ò %�Ø—‘˜tÕ$ð%ð
 ×Ñ˜U BÔ'ð �M‰M˜$ÔØ˜‘8ˆOùòQ4s   £DrI   rÀ   N)rm  r5  r=   r5  )r[   )r`   rr  s   ` r9   Útest_boundedStackDepthz$DeferredTests.test_boundedStackDepth  s%   ø€ õ/	ðf 	×Ñ™¨Ó*©N¸1Ó,=Õ>r;   c                óZ  ‡‡— t        «       }t        «       Št        «       Š|j                  ˆfd„«       ‰j                  ˆfd„«       ‰j                  d«       |j                  d«       ‰j                  d«       g }‰j                  |j                  «       | j	                  |dg«       y)a  
        Given three Deferreds, one chained to the next chained to the next,
        callbacks on the middle Deferred which are added after the chain is
        created are called once the last Deferred fires.

        This is more of a regression-style test.  It doesn't exercise any
        particular code path through the current implementation of Deferred, but
        it does exercise a broken codepath through one of the variations of the
        implementation proposed as a resolution to ticket #411.
        c                ó   •— ‰S r3   rG   r]  s    €r9   rð   zZDeferredTests.test_resultOfDeferredResultOfDeferredOfFiredDeferredCalled.<locals>.<lambda>N  r_  r;   c                ó   •— ‰S r3   rG   )rV  r  s    €r9   rð   zZDeferredTests.test_resultOfDeferredResultOfDeferredOfFiredDeferredCalled.<locals>.<lambda>O  s   ø€ ¨5€ r;   N)r    rœ   rO   rZ   r[   )r`   r`  re  r^  r  s      @@r9   Ú:test_resultOfDeferredResultOfDeferredOfFiredDeferredCalledzHDeferredTests.test_resultOfDeferredResultOfDeferredOfFiredDeferredCalled@  s…   ù€ ô !)£
ˆÜ!)£ˆÜ (£
ˆØ×ÑÓ0Ô1Ø×ÑÓ0Ô1Ø�‰˜ÔØ�‰�tÔØ�‰�tÔØ ˆØ×Ñ˜7Ÿ>™>Ô*Ø×Ñ˜ 4 &Õ)r;   c                óŠ  — t        j                  d«       t        «       }g }t        d«      }	 |‚# t        $ r |j                  «        Y nw xY w|j                  |j                  «       |d   }| j                  |j                  |«       |j                  d   dd \  }}| j                  g |«       | j                  g |«       y)z¿
        C{Deferred.errback()} creates a failure from the current Python
        exception.  When Deferred.debug is not set no globals or locals are
        captured in that failure.
        Frá   r   éþÿÿÿN)r   rˆ   r    rB   rJ   rª   rY   rZ   r[   r_   Úframes©r`   r#  r"  Úexcr'  ÚlocalzÚglobalzs          r9   Útest_errbackWithNoArgsNoDebugz+DeferredTests.test_errbackWithNoArgsNoDebugW  s¯   € ô 	×Ñ˜5Ô!Ü$›JˆØˆÜ˜6Ó"ˆð	ØˆIøÜò 	Ø�I‰IŽKð	úà	�‰�Q—X‘XÔØ�‰tˆØ×Ñ˜Ÿ™ SÔ)ØŸ+™+ a™.¨¨Ð-‰ˆ�Ø×Ñ˜˜VÔ$Ø×Ñ˜˜WÕ%ó   ®0 °AÁAc                óŠ  — t        j                  d«       t        «       }g }t        d«      }	 |‚# t        $ r |j                  «        Y nw xY w|j                  |j                  «       |d   }| j                  |j                  |«       |j                  d   dd \  }}| j                  g |«       | j                  g |«       y)z¹
        C{Deferred.errback()} creates a failure from the current Python
        exception.  When Deferred.debug is set globals and locals are captured
        in that failure.
        Trá   r   ry  N)r   rˆ   r    rB   rJ   rª   rY   rZ   r[   r_   rz  ÚassertNotEqualr{  s          r9   Útest_errbackWithNoArgsz$DeferredTests.test_errbackWithNoArgsl  s¯   € ô 	×Ñ˜4Ô Ü$›JˆØˆÜ˜6Ó"ˆð	ØˆIøÜò 	Ø�I‰IŽKð	úà	�‰�Q—X‘XÔØ�‰tˆØ×Ñ˜Ÿ™ SÔ)ØŸ+™+ a™.¨¨Ð-‰ˆ�Ø×Ñ˜B Ô'Ø×Ñ˜B Õ(r€  c                óD  — t        «       }|j                  d«       t        j                  d«       dd„}|j	                  |«       g }|j                  |j                  «       |d   }|j                  d   dd \  }}| j                  g |«       | j                  g |«       y)úœ
        An error raised by a callback creates a Failure.  The Failure captures
        locals and globals if and only if C{Deferred.debug} is set.
        NFc                ó   — t        d«      ‚©Nrá   ©rB   ©rV  s    r9   Ú
raiseErrorzHDeferredTests.test_errorInCallbackDoesNotCaptureVars.<locals>.raiseErrorŠ  ó   € Ü˜vÓ&Ð&r;   r   ry  rj  )	r    rO   r   rˆ   rœ   rY   rZ   rz  r[   ©r`   r#  rŠ  r"  r'  r}  r~  s          r9   Ú&test_errorInCallbackDoesNotCaptureVarsz4DeferredTests.test_errorInCallbackDoesNotCaptureVars�  sŽ   € ô
 %›JˆØ	�
‰
�4ÔÜ×Ñ˜5Ô!ó	'ð 	
�‰�jÔ!ØˆØ	�‰�Q—X‘XÔØ�‰tˆØŸ+™+ a™.¨¨Ð-‰ˆ�Ø×Ñ˜˜VÔ$Ø×Ñ˜˜WÕ%r;   c                óD  — t        «       }|j                  d«       t        j                  d«       dd„}|j	                  |«       g }|j                  |j                  «       |d   }|j                  d   dd \  }}| j                  g |«       | j                  g |«       y)r…  NTc                ó   — t        d«      ‚r‡  rˆ  r‰  s    r9   rŠ  zODeferredTests.test_errorInCallbackCapturesVarsWhenDebugging.<locals>.raiseErrorž  r‹  r;   r   ry  rj  )	r    rO   r   rˆ   rœ   rY   rZ   rz  r‚  rŒ  s          r9   Ú-test_errorInCallbackCapturesVarsWhenDebuggingz;DeferredTests.test_errorInCallbackCapturesVarsWhenDebugging•  sŽ   € ô
 %›JˆØ	�
‰
�4ÔÜ×Ñ˜4Ô ó	'ð 	
�‰�jÔ!ØˆØ	�‰�Q—X‘XÔØ�‰tˆØŸ+™+ a™.¨¨Ð-‰ˆ�Ø×Ñ˜B Ô'Ø×Ñ˜B Õ(r;   c                ó~  — t        «       }t        «       }	 |j                  «        dd„}t        j                  |«       | j                  |«      }t        j                  |j                  «       «      }| j                  t        |«      d«       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d	|d   d   «       y
# t        $ r |j	                  «        Y �Œw xY w)ú�
        L{defer.inlineCallbacks} that re-raise tracebacks into their deferred
        should not lose their tracebacks.
        c              3  ó   K  — | –— y­w)aJ  
            This is never called.
            It is only used as the decorated function.
            The resulting function is never called in this test.
            This is used to make sure that if we wrap
            an already failed deferred, inlineCallbacks
            will not add any extra traceback frames.
            NrG   ©r#  s    r9   Úicz8DeferredTests.test_inlineCallbacksTracebacks.<locals>.icµ  s   è ø€ ð ‹Gùó   ‚rî  Ú
test_deferrÀ   r   rK   ú1 / 0Útest_inlineCallbacksTracebacksúf.raiseException()N©r#  r<   r=   zGenerator[Any, Any, None]©rK   r    ÚraiseExceptionrJ   rª   r   ÚinlineCallbacksrû   r_  Ú
extract_tbÚgetTracebackObjectr[   r\   ÚassertIn©r`   r8   r#  r•  Ú
newFailureÚtbs         r9   r™  z,DeferredTests.test_inlineCallbacksTracebacks©  s  € ô
 Ó ˆÜ$›Jˆð	Ø×ÑÔó		ô 	×Ñ˜bÔ!Ø×)Ñ)¨!Ó,ˆ
Ü×!Ñ! *×"?Ñ"?Ó"AÓBˆà×Ñœ˜R› !Ô$Ø�‰�l B q¡E¨!¡HÔ-Ø×ÑÐ-¨r°!©u°Q©xÔ8Ø×Ñ˜ " Q¡%¨¡(Ô+à�‰�l B q¡E¨!¡HÔ-Ø×ÑÐ9¸2¸a¹5À¹8ÔDØ×ÑÐ-¨r°!©u°Q©xÕ8øô3 ò 	Ø�I‰I�Kð	úó   –D ÄD<Ä;D<c                ó°   — dd„}t        j                   |«       «      }t        |t         t           «       | j	                  d| j                  |«      «       y)zM
        It can discover the return type of a first level coroutine.
        c               “  ó   K  — y­wrD  rG   rG   r;   r9   Ú
returnsIntz4DeferredTests.test_fromCoroutine.<locals>.returnsIntÒ  r™  rš  rI   Nr›  )r    r4   r   r5  r[   r  )r`   r¨  r#  s      r9   Útest_fromCoroutinez DeferredTests.test_fromCoroutineÍ  sD   € ó
	ô ×"Ñ"¡:£<Ó0ˆÜ�A”x¤‘}Ô%Ø×Ñ˜˜D×0Ñ0°Ó3Õ4r;   c                óž   — d„ dd| j                   dt        g}|D ]1  }| j                  t        j                  t        j
                  |«       Œ3 y)ú‰
        L{Deferred.fromCoroutine} requires a coroutine object or a generator,
        and will reject things that are not that.
        c                ó   — | S r3   rG   r}  s    r9   rð   zCDeferredTests.test_fromCoroutineRequiresCoroutine.<locals>.<lambda>à  ó   € �a€ r;   rI   TN©Ú#test_fromCoroutineRequiresCoroutiner   ÚassertRaisesÚNotACoroutineErrorr    r4   ©r`   ÚthingsThatAreNotCoroutinesÚthings      r9   r¯  z1DeferredTests.test_fromCoroutineRequiresCoroutineÙ  óV   € ñ ààà×4Ñ4àäð&
Ð"ð 0ò 	WˆEØ×Ñœe×6Ñ6¼×8NÑ8NÐPUÕVñ	Wr;   úGC works differently on PyPy.c                ó  — t        «       }t        j                  |«      }t        |«      }||_        t        j                  |«      }|j                  d«       ~~| j                   |«       «       | j                   |«       «       y)z|
        A circular reference between a `Deferred` and its canceller
        is broken when the deferred is called.
        N)ÚDummyCancellerÚweakrefÚrefr    rQ   rO   r�   )r`   Ú	cancellerÚweakCancellerrQ   ÚweakDeferreds        r9   Ú*test_canceller_circular_reference_callbackz8DeferredTests.test_canceller_circular_reference_callbackð  st   € ô #Ó$ˆ	ÜŸ™ IÓ.ˆô #+¨9Ó"5ˆØ%ˆ	ÔÜ—{‘{ 8Ó,ˆà×Ñ˜$Ôð Øð 	×Ñ™-›/Ô*Ø×Ñ™,›.Õ)r;   c                óX  — t        «       }t        j                  |«      }t        |«      }||_        t        j                  |«      }t        t        d«      «      }|j                  |«       | j                  |«       ~~| j                   |«       «       | j                   |«       «       y)zx
        A circular reference between a `Deferred` and its canceller
        is broken when the deferred fails.
        úThe test demands failures.N)
r¸  r¹  rº  r    rQ   r/   r¯  rª   rû   r�   )r`   r»  r¼  rQ   r½  rO  s         r9   Ú)test_canceller_circular_reference_errbackz7DeferredTests.test_canceller_circular_reference_errback  s’   € ô #Ó$ˆ	ÜŸ™ IÓ.ˆô #+¨9Ó"5ˆØ%ˆ	ÔÜ—{‘{ 8Ó,ˆäœ)Ð$@ÓAÓBˆØ×Ñ˜Ô!ð 	×Ñ˜XÔ&àØð 	×Ñ™-›/Ô*Ø×Ñ™,›.Õ)r;   c                óÜ   — t        «       }t        j                  |«      }t        |«      }||_        |j                  d„ «       |j                  d«       ~~| j                   |«       «       y)z¶
        A circular reference between a `Deferred` and its canceller is broken
        when the deferred is called, even if another deferred gets added to its
        chain.
        c                ó   — t        «       S r3   )r    r0  s    r9   rð   zKDeferredTests.test_canceller_circular_reference_non_final.<locals>.<lambda>>  s   € ¤x£z€ r;   N)r¸  r¹  rº  r    rQ   rœ   rO   r�   )r`   r»  r¼  rQ   s       r9   Ú+test_canceller_circular_reference_non_finalz9DeferredTests.test_canceller_circular_reference_non_final-  sc   € ô #Ó$ˆ	ÜŸ™ IÓ.ˆô #+¨9Ó"5ˆØ%ˆ	Ôà×ÑÑ1Ô2Ø×Ñ˜$ÔàØð 	×Ñ™-›/Õ*r;   Nr€   )r5   r<   r6   r<   r=   r   ©r5   r<   r6   r<   r=   r|   )r5   r/   r6   r<   r=   r|   )ZrD   rE   rF   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,  r6  r9  rA  rJ  rS  rZ  ra  rf  rm  rp  rs  ry  r‚  r‡  rŒ  r‘  r”  r�  r¨  r°  rÉ  râ  rê  rû  rÿ  r  r  r  r  r  r  r%  r,  r2  r4  r7  rG  rP  rW  rY  r[  rs  rw  r  rƒ  r�  r�  r™  r©  r¯  ÚpyunitÚskipIfr-   r¾  rÁ  rÄ  rG   r;   r9   r‚   r‚   ³   s  „ óBóó-ó+óAóIóQóBó5óAó"5ó,"
óH%ó('.óR?ó"?ó"&ó&ó"
@óBó$
@ó9óKó:ó"+ó )ó.)ó=ó)ó2ó2ó
=óó
ó6
ó<3ó,-ó()ó &ó >ó(Kó?ó1ó(ó >ó"2ó$
.ó	6óEóDó2
ó.*
óX%
óN-
ó^,ó.)ó(>ó(*ó&1ó4:ó(/ó:0ó>;
ózF
óP'ó(ó
'ó
ó.)ó.BóYó
ó9?óv*ó.&ó*)ó*&ó()ó("9óH
5óWð. €V‡]�]�5Ð9Ó:ò*ó ;ð*ð8 €V‡]�]�5Ð9Ó:ò*ó ;ð*ð> €V‡]�]�5Ð9Ó:ò+ó ;ñ+r;   r‚   c                  ó(   — e Zd ZU dZdZded<   dd„Zy)r¸  z†
    A callable that does nothing.
    It is intended to be used just to get an object reference
    to support GC related tests.
    NzOptional[Deferred[Any]]rQ   c                 ó   — y)zV
        This is not expected to be called as part of the current test suite.
        NrG   rž   s     r9   Ú__call__zDummyCanceller.__call__R  rñ   r;   )rQ   re   r=   r|   )rD   rE   rF   rf   rQ   Ú__annotations__rÊ  rG   r;   r9   r¸  r¸  I  s   … ñð )-€HÐ%Ó,ôr;   r¸  c                ó‚   ‡— dg| z  Šg }t        | «      D ]%  }|fdˆfd„}|j                  t        |¬«      «       Œ' ‰|fS )zÄ
    Create a list of Deferreds and a corresponding list of integers
    tracking how many times each Deferred has been cancelled.  Without
    additional steps the Deferreds will never fire.
    r   c                ó    •— ‰|xx   dz  cc<   y rD  rG   )r#  ÚnÚcancelledStates     €r9   rú   z_setupRaceState.<locals>.cancelc  s   ø€ Ø˜1Ó Ñ"Ôr;   ©r»  )r#  r  rÎ  r5  r=   r|   )rk  rZ   r    )ÚnumDeferredsÚdsrÎ  rú   rÏ  s       @r9   Ú_setupRaceStaterÓ  X  sR   ø€ ð �S˜<Ñ'€Nà!#€BÜ�<Ó ò .ˆà12ö 	#ð 	�	‰	”( VÔ,Õ-ð.ð ˜2ÐÐr;   c                  ó  — e Zd ZdZ e edd¬«       edd¬«      ¬«      dd„«       Z e edd¬«       edd¬«      ¬«      dd„«       Z e edd¬«       edd¬«      ¬«      dd„«       Zdd	„Z	 e ed
d¬«      ¬«      dd„«       Z
y)Ú	RaceTestsz
    Tests for L{race}.
    r   rî  )Ú	min_valueÚ	max_value)ÚbeforeWinnerÚafterWinnerc                ó  — t        |dz   |z   «      \  }}t        |«      }t        «       }||   j                  |«       t	        | j                  |«      t        ||f«      «       dg|z  dgz   dg|z  z   }t	        |t        |«      «       y)a	  
        When one of the L{Deferred}s passed to L{race} fires successfully,
        the L{Deferred} return by L{race} fires with the index of that
        L{Deferred} and its result and cancels the rest of the L{Deferred}s.

        @param beforeWinner: A randomly selected number of Deferreds to
            appear before the "winning" Deferred in the list passed in.

        @param beforeWinner: A randomly selected number of Deferreds to
            appear after the "winning" Deferred in the list passed in.
        rI   r   N)rÓ  r*   r<   rO   r   r  r   )r`   rØ  rÙ  rÏ  rÒ  Ú
raceResultrX  ÚexpectedCancelledStates           r9   Útest_successzRaceTests.test_successp  s›   € ô  -¨\¸AÑ-=ÀÑ-KÓLÑˆ˜ä˜"“Xˆ
Ü“8ˆØ
ˆ<Ñ×!Ñ! (Ô+ô 	Ø× Ñ  Ó,Ü�l HÐ-Ó.ô	
ð
 #$  |Ñ!3°q°cÑ!9¸Q¸CÀ+Ñ<MÑ!MÐÜØÜÐ+Ó,õ	
r;   c           	     óv  — t        |dz   |z   «      \  }}t        t        d«      «      }t        |«      }|D ]  }|j	                  |«       Œ | j                  |t        «      }t        |j                  j                  t        |gt        |«      z  «      «       t        |t        dgt        |«      z  «      «       y)aâ  
        When all of the L{Deferred}s passed to L{race} fire with failures,
        the L{Deferred} return by L{race} fires with L{FailureGroup} wrapping
        all of their failures.

        @param beforeWinner: A randomly selected number of Deferreds to
            appear before the "winning" Deferred in the list passed in.

        @param beforeWinner: A randomly selected number of Deferreds to
            appear after the "winning" Deferred in the list passed in.
        rI   rÀ  r   N)rÓ  r/   r¯  r*   rª   rû   r&   r   r_   rc   r   r\   )	r`   rØ  rÙ  rÏ  rÒ  rO  rÛ  r#  ÚactualFailures	            r9   Útest_failurezRaceTests.test_failure“  s®   € ô  -¨\¸AÑ-=ÀÑ-KÓLÑˆ˜äœ)Ð$@ÓAÓBˆÜ˜"“Xˆ
Øò 	ˆAØ�I‰I�gÕð	ð ×,Ñ,¨Z¼ÓFˆÜØ×Ñ×(Ñ(Ü�g�Y¤ R£Ñ(Ó)ô	
ô 	ØÜ�a�Sœ3˜r›7‘]Ó#õ	
r;   c                ó,  — t        |dz   |z   «      D �cg c]  }t        «       ‘Œ }}t        |«      }||   j                  d«       ||dz      j                  d«       | j	                  |«       t        | j                  «       t        «       «       yc c}w )zª
        If one of the Deferreds fires after it was cancelled its result
        goes nowhere.  In particular, it does not cause any errors to be
        logged.
        rÀ   NrI   )rk  r    r*   rO   r  r   rl   r   )r`   rØ  rÙ  rÎ  rÒ  rÛ  s         r9   Útest_resultAfterCancelz RaceTests.test_resultAfterCancel´  s�   € ô !& l°QÑ&6¸Ñ&DÓ Eö$
ØŒH�Jð$
ˆð $
ô ˜"“Xˆ
Ø
ˆ<Ñ×!Ñ! $Ô'Ø
ˆ<˜!ÑÑ×%Ñ% dÔ+à×Ñ˜ZÔ(Ü�D×*Ñ*Ó,¬e«gÕ6ùò$
s   ”Bc                óÎ   — t        «       }|t        d„ ¬«      g}t        «       }t        |«      }|j                  |«       t	        | j                  |«      t        d|f«      «       y)z~
        If one of the input Deferreds has a cancel function that fires it
        with success, nothing bad happens.
        c                ó4   — | j                  t        «       «      S r3   )rO   r<   r”  s    r9   rð   z1RaceTests.test_resultFromCancel.<locals>.<lambda>Ó  s   € ¨¯©´F³HÓ)=€ r;   rÐ  r   N)r    r<   r*   rO   r   r  r   )r`   ÚwinnerrÒ  rX  rÛ  s        r9   Útest_resultFromCancelzRaceTests.test_resultFromCancelË  sZ   € ô
 $,£:ˆàÜÑ=Ô>ð&
ˆô “8ˆÜ˜"“Xˆ
Ø�‰˜Ô!ä�D×(Ñ(¨Ó4´hÀÀ8¸}Ó6MÕNr;   rI   )rÑ  c                ó´   — t        |«      \  }}t        |«      }|j                  «        t        |t	        dg|z  «      «       | j                  |t        «       y)zu
        If the result of L{race} is cancelled then all of the L{Deferred}s
        passed in are cancelled.
        rI   N)rÓ  r*   rú   r   r   rû   r&   )r`   rÑ  rÏ  rÒ  rÛ  s        r9   Útest_cancelzRaceTests.test_cancelÛ  sN   € ô -¨\Ó:Ñˆ˜ä˜"“Xˆ
Ø×ÑÔä�N¤H¨a¨S°<Ñ-?Ó$@ÔAØ×Ñ˜Z¬Õ6r;   N)rØ  r5  rÙ  r5  r=   r|   r€   )rÑ  r5  r=   r|   )rD   rE   rF   rf   r   r   rÝ  rà  râ  ræ  rè  rG   r;   r9   rÕ  rÕ  k  s·   „ ññ Ù¨°QÔ7Ù q°AÔ6ôò
ó	ð
ñ> Ù¨°QÔ7Ù q°AÔ6ôò
ó	ð
ñ: Ù¨°QÔ7Ù q°AÔ6ôò7ó	ð7ó&Oñ  Ù¨°QÔ7ôò7óñ7r;   rÕ  c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)ÚFirstErrorTestsz"
    Tests for L{FirstError}.
    c                óÎ   — t        d«      }	 |‚# t        $ r t        «       }Y nw xY wt        j                  |d«      }| j                  t        |«      dt        |«      › d�«       y)z¦
        The repr of a L{FirstError} instance includes the repr of the value of
        the sub-failure and the index which corresponds to the L{FirstError}.
        ú	some textrî  zFirstError[#3, ú]N)rR  rJ   r/   r   rÚ   r[   rU  ©r`   r|  r8   rn   s       r9   rW  zFirstErrorTests.test_reprñ  sc   € ô
 ˜Ó%ˆð	ØˆIøÜò 	Ü“	ŠAð	úô × Ñ   AÓ&ˆØ×Ñœ˜e›¨¼¸S»	°{À!Ð&DÕEó   � �%¤%c                óÎ   — t        d«      }	 |‚# t        $ r t        «       }Y nw xY wt        j                  |d«      }| j                  t        |«      dt        |«      › d�«       y)z—
        The str of a L{FirstError} instance includes the str of the
        sub-failure and the index which corresponds to the L{FirstError}.
        rì  r|  zFirstError[#5, rí  N)rR  rJ   r/   r   rÚ   r[   r®   rî  s       r9   Útest_strzFirstErrorTests.test_strÿ  sc   € ô
 ˜Ó%ˆð	ØˆIøÜò 	Ü“	ŠAð	úô × Ñ   AÓ&ˆØ×Ñœ˜U› ´s¸1³v°h¸aÐ%@ÕArï  c                óØ  — 	 ddz   t        j                  d«      }t        j                  |d«      }	 t	        d«      ‚# t         $ r t        «       }Y ŒMw xY w# t         $ r t        «       }Y nw xY wt        j                  |d«      }| j                  ||k(  «       | j                  ||k(  «       | j                  ||k7  «       | j                  ||k7  «       | j                  |dk(  «       y)zÖ
        L{FirstError} instances compare equal to each other if and only if
        their failure and index compare equal.  L{FirstError} instances do not
        compare equal to instances of other types.
        rI   r   é   Úbaré	   r€  N)rJ   r/   r   rÚ   rR  r]   r  )r`   ÚfirstFailureÚoneÚ
anotherOneÚsecondFailureÚanothers         r9   Útest_comparisonzFirstErrorTests.test_comparison  sß   € ð	%Ø�ŠFô ×Ñ˜|¨RÓ0ˆÜ×%Ñ% l°BÓ7ˆ
ð	&Ü˜UÓ#Ð#øô ò 	%Ü"›9ŠLð	%ûô ò 	&Ü#›IŠMð	&úô ×"Ñ" =°!Ó4ˆà�‰˜˜zÑ)Ô*Ø×Ñ˜ ™Ô(Ø�‰˜˜w™Ô'Ø×Ñ˜ 
Ñ*Ô+à×Ñ˜ ™Õ#s    ‚? ´A ¿AÁAÁA.Á-A.Nr€   )rD   rE   rF   rf   rW  rñ  rû  rG   r;   r9   rê  rê  ì  s   „ ñóFóBô$r;   rê  c                  ó¬   — e Zd Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)ÚAlreadyCalledTestsc                ó`   — t        j                  «       | _        t        j                  d«       y ©NT)r   r‰   Ú_deferredWasDebuggingrˆ   rŠ   s    r9   r‹   zAlreadyCalledTests.setUp+  s!   € Ü%*×%7Ñ%7Ó%9ˆÔ"Ü×Ñ˜4Õ r;   c                óB   — t        j                  | j                  «       y r3   )r   rˆ   r   rŠ   s    r9   ÚtearDownzAlreadyCalledTests.tearDown/  s   € Ü×Ñ˜4×5Ñ5Õ6r;   c                 ó   — y r3   rG   r�   s      r9   r�   zAlreadyCalledTests._callback2  ó   € Ør;   c                 ó   — y r3   rG   r�   s      r9   r–   zAlreadyCalledTests._errback5  r  r;   c                ó&   — |j                  d«       y )Nr™   rN   r8  s     r9   Ú_call_1zAlreadyCalledTests._call_18  ó   € Ø	�
‰
�7Õr;   c                ó&   — |j                  d«       y )NÚtwicerN   r8  s     r9   Ú_call_2zAlreadyCalledTests._call_2;  r  r;   c                óH   — |j                  t        t        «       «      «       y r3   ©rª   r/   rj   r8  s     r9   Ú_err_1zAlreadyCalledTests._err_1>  ó   € Ø	�	‰	”'œ,›.Ó)Õ*r;   c                óH   — |j                  t        t        «       «      «       y r3   r  r8  s     r9   Ú_err_2zAlreadyCalledTests._err_2A  r  r;   c                óÜ   — t        «       }|j                  | j                  | j                  «       | j	                  |«       | j                  t        j                  | j                  |«       y r3   )	r    r©   r�   r–   r  r°  r   ÚAlreadyCalledErrorr  r8  s     r9   ÚtestAlreadyCalled_CCz'AlreadyCalledTests.testAlreadyCalled_CCD  sF   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�QŒØ×Ñœ%×2Ñ2°D·L±LÀ!ÕDr;   c                óÜ   — t        «       }|j                  | j                  | j                  «       | j	                  |«       | j                  t        j                  | j                  |«       y r3   )	r    r©   r�   r–   r  r°  r   r  r  r8  s     r9   ÚtestAlreadyCalled_CEz'AlreadyCalledTests.testAlreadyCalled_CEJ  sF   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�QŒØ×Ñœ%×2Ñ2°D·K±KÀÕCr;   c                óÜ   — t        «       }|j                  | j                  | j                  «       | j	                  |«       | j                  t        j                  | j                  |«       y r3   )	r    r©   r�   r–   r  r°  r   r  r  r8  s     r9   ÚtestAlreadyCalled_EEz'AlreadyCalledTests.testAlreadyCalled_EEP  sF   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�AŒØ×Ñœ%×2Ñ2°D·K±KÀÕCr;   c                óÜ   — t        «       }|j                  | j                  | j                  «       | j	                  |«       | j                  t        j                  | j                  |«       y r3   )	r    r©   r�   r–   r  r°  r   r  r  r8  s     r9   ÚtestAlreadyCalled_ECz'AlreadyCalledTests.testAlreadyCalled_ECV  sF   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�AŒØ×Ñœ%×2Ñ2°D·L±LÀ!ÕDr;   c                óœ   — d}|D ]1  }|j                  d|z  «      sŒ|j                  d|z  «      sŒ-|dz  }Œ3 | j                  ||k(  «       y )Nr   z %s:z %srI   )r~   Úendswithr]   )r`   ÚlinetypeÚfuncÚlinesrX  ÚcountÚlines          r9   Ú_countzAlreadyCalledTests._count\  sR   € ØˆØò 	ˆDØ�‰˜v¨Ñ0Õ1°d·m±mÀEÈDÁLÕ6QØ˜‘
‘ð	ð 	�‰˜ Ñ)Õ*r;   c                óX  — |j                   d   j                  d«      }| j                  d||d«       | j                  dd|d«       | j                  dd|d«       | j                  dd|d«       | j                  dd|d«       | j                  d	||d«       | j                  d	||d«       y )
Nr   ú
ÚCrI   r  r  r  r  ÚI)r5   Úsplitr"  )r`   rï   ÚcallerÚinvoker1Úinvoker2r  s         r9   Ú_checkzAlreadyCalledTests._checkc  s˜   € à—‘�q‘	—‘ Ó%ˆð 	�‰�C˜ ¨Ô*Ø�‰�C˜ E¨1Ô-Ø�‰�C˜ E¨1Ô-Ø�‰�C˜ 5¨!Ô,Ø�‰�C˜ 5¨!Ô,à�‰�C˜ 5¨!Ô,Ø�‰�C˜ 5¨!Õ,r;   c                ó4  — t        «       }|j                  | j                  | j                  «       | j	                  |«       	 | j                  |«       | j                  d«       y # t        j                  $ r}| j                  |ddd«       Y d }~y d }~ww xY w)Nú2second callback failed to raise AlreadyCalledErrorÚtestAlreadyCalledDebug_CCr  r  )
r    r©   r�   r–   r  r  r'  r   r  r+  ©r`   r#  rï   s      r9   r.  z,AlreadyCalledTests.testAlreadyCalledDebug_CCq  sz   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�QŒð	LØ�L‰L˜ŒOð �I‰IÐJÕKøô ×'Ñ'ò 	NØ�K‰K˜Ð6¸	À9×MÑMûð	Núó   ÁA& Á&BÁ9BÂBc                ó4  — t        «       }|j                  | j                  | j                  «       | j	                  |«       	 | j                  |«       | j                  d«       y # t        j                  $ r}| j                  |ddd«       Y d }~y d }~ww xY w)Nú1second errback failed to raise AlreadyCalledErrorÚtestAlreadyCalledDebug_CEr  r  )
r    r©   r�   r–   r  r  r'  r   r  r+  r/  s      r9   r3  z,AlreadyCalledTests.testAlreadyCalledDebug_CE|  sz   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�QŒð	KØ�K‰K˜ŒNð �I‰IÐIÕJøô ×'Ñ'ò 	MØ�K‰K˜Ð6¸	À8×LÑLûð	Múr0  c                ó4  — t        «       }|j                  | j                  | j                  «       | j	                  |«       	 | j                  |«       | j                  d«       y # t        j                  $ r}| j                  |ddd«       Y d }~y d }~ww xY w)Nr-  ÚtestAlreadyCalledDebug_ECr  r  )
r    r©   r�   r–   r  r  r'  r   r  r+  r/  s      r9   r5  z,AlreadyCalledTests.testAlreadyCalledDebug_EC‡  sz   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�AŒð	LØ�L‰L˜ŒOð �I‰IÐJÕKøô ×'Ñ'ò 	MØ�K‰K˜Ð6¸À)×LÑLûð	Múr0  c                ó4  — t        «       }|j                  | j                  | j                  «       | j	                  |«       	 | j                  |«       | j                  d«       y # t        j                  $ r}| j                  |ddd«       Y d }~y d }~ww xY w)Nr2  ÚtestAlreadyCalledDebug_EEr  r  )
r    r©   r�   r–   r  r  r'  r   r  r+  r/  s      r9   r7  z,AlreadyCalledTests.testAlreadyCalledDebug_EE’  sz   € Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�AŒð	KØ�K‰K˜ŒNð �I‰IÐIÕJøô ×'Ñ'ò 	LØ�K‰K˜Ð6¸À(×KÑKûð	Lúr0  c                ól  — t        j                  d«       t        «       }|j                  | j                  | j
                  «       | j                  |«       	 | j                  |«       | j                  d«       y # t         j                  $ r%}| j                  |j                  «       Y d }~y d }~ww xY w)NFr-  )r   rˆ   r    r©   r�   r–   r  r  r'  r  r  r5   r/  s      r9   ÚtestNoDebuggingz"AlreadyCalledTests.testNoDebugging�  s…   € Ü×Ñ˜5Ô!Ü#›:ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø�‰�QŒð	LØ�L‰L˜ŒOð �I‰IÐJÕKøô ×'Ñ'ò 	%Ø×Ñ˜QŸV™V×$Ñ$ûð	%ús   ÁA; Á;B3ÂB.Â.B3c                ó`  — t        j                  d«       t        «       }|j                  d„ «       t        j                  d«       |j	                  d «       t        j                  d«       t        «       }|j	                  d «       t        j                  d«       |j                  d„ «       y )NFc                 ó   — y r3   rG   ©r
  s    r9   rð   z8AlreadyCalledTests.testSwitchDebugging.<locals>.<lambda>®  rñ   r;   Tc                 ó   — y r3   rG   r<  s    r9   rð   z8AlreadyCalledTests.testSwitchDebugging.<locals>.<lambda>¶  rñ   r;   )r   rˆ   r    ÚaddBothrO   r8  s     r9   ÚtestSwitchDebuggingz&AlreadyCalledTests.testSwitchDebugging©  s|   € ô 	×Ñ˜5Ô!Ü$›JˆØ	�	‰	Ñ"Ô#Ü×Ñ˜4Ô Ø	�
‰
�4Ôä×Ñ˜5Ô!Ü‹JˆØ	�
‰
�4ÔÜ×Ñ˜4Ô Ø	�	‰	Ñ"Õ#r;   Nr€   rÅ  )r#  rQ  r=   r|   )
r  r®   r  r®   r  rØ  rX  r5  r=   r|   )
rï   r¯  r(  r®   r)  r®   r*  r®   r=   r|   )rD   rE   rF   r‹   r  r�   r–   r  r  r  r  r  r  r  r  r"  r+  r.  r3  r5  r7  r9  r?  rG   r;   r9   rý  rý  *  so   „ ó!ó7óóóóó+ó+óEóDóDóEó+ó-ó	Ló	Kó	Ló	Kó
Lô$r;   rý  c                  ó¤   — e Zd Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)ÚDeferredCancellerTestsc                ó<   — d | _         d | _        d | _        d| _        y r�   )r„   r†   r…   ÚcancellerCallCountrŠ   s    r9   r‹   zDeferredCancellerTests.setUpº  s"   € Ø.2ˆÔØ15ˆÔØ/3ˆÔØ"#ˆÕr;   c                ó<   — | j                  | j                  d«       y )Nrh  )r¡  rC  rŠ   s    r9   r  zDeferredCancellerTests.tearDownÀ  s   € à�‰�d×-Ñ-¨vÕ6r;   c                ó   — || _         |S r3   rŽ   ©r`   Údatas     r9   r�   z DeferredCancellerTests._callbackÄ  s   € Ø#ˆÔØˆr;   c                ó   — || _         y r3   r’   rF  s     r9   r“   z!DeferredCancellerTests._callback2È  s
   € Ø $ˆÕr;   c                ó   — || _         y r3   r•   )r`   rn   s     r9   r–   zDeferredCancellerTests._errbackË  s
   € Ø#ˆÕr;   c                ó>  — t        «       }|j                  | j                  | j                  «       |j	                  «        | j
                  €J ‚| j                  | j
                  j                  t        j                  «       | j                  | j                  «       y)zy
        A L{Deferred} without a canceller must errback with a
        L{defer.CancelledError} and not callback.
        N)r    r©   r�   r–   rú   r†   r[   rÙ   r   r   r�   r„   r8  s     r9   Útest_noCancellerz'DeferredCancellerTests.test_noCancellerÎ  sr   € ô
 %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHØ×Ñ˜$×.Ñ.Õ/r;   c                ób  — t        «       }|j                  | j                  | j                  «       |j	                  «        |j                  d«       | j                  t        j                  |j
                  d«       | j                  t        j                  |j                  t        «       «       y)zÌ
        A L{Deferred} without a canceller, when cancelled must allow
        a single extra call to callback, and raise
        L{defer.AlreadyCalledError} if callbacked or errbacked thereafter.
        N)r    r©   r�   r–   rú   rO   r°  r   r  rª   r¯  r8  s     r9   Ú!test_raisesAfterCancelAndCallbackz8DeferredCancellerTests.test_raisesAfterCancelAndCallbackÚ  st   € ô %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
ð 	
�
‰
�4Ôð 	×Ñœ%×2Ñ2°A·J±JÀÔEØ×Ñœ%×2Ñ2°A·I±I¼y»{ÕKr;   c                ór  — t        «       }|j                  | j                  | j                  «       |j	                  «        |j                  t        «       «       | j                  t        j                  |j                  d«       | j                  t        j                  |j
                  t        «       «       y)zË
        A L{Deferred} without a canceller, when cancelled must allow
        a single extra call to errback, and raise
        L{defer.AlreadyCalledError} if callbacked or errbacked thereafter.
        N)r    r©   r�   r–   rú   rª   r¯  r°  r   r  rO   r8  s     r9   Ú test_raisesAfterCancelAndErrbackz7DeferredCancellerTests.test_raisesAfterCancelAndErrbackë  sv   € ô %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
ð 	
�	‰	”)“+Ôð 	×Ñœ%×2Ñ2°A·J±JÀÔEØ×Ñœ%×2Ñ2°A·I±I¼y»{ÕKr;   c                ó  — t        «       }|j                  | j                  | j                  «       |j	                  «        | j
                  }|j                  d«       |j	                  «        | j                  || j
                  «       y)z…
        A L{Deferred} without a canceller, when cancelled and then
        callbacked, ignores multiple cancels thereafter.
        N)r    r©   r�   r–   rú   r†   rO   rm   ©r`   r#  ÚcurrentFailures      r9   Ú5test_noCancellerMultipleCancelsAfterCancelAndCallbackzLDeferredCancellerTests.test_noCancellerMultipleCancelsAfterCancelAndCallbackü  s^   € ô
 %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×,Ñ,ˆà	�
‰
�4Ôà	�‰Œ
Ø�‰�n d×&9Ñ&9Õ:r;   c                ó  — t        «       }|j                  | j                  | j                  «       |j	                  «        | j
                  €J ‚| j                  | j
                  j                  t        j                  «       | j
                  }|j                  t        «       «       | j                  | j
                  j                  t        j                  «       |j	                  «        | j                  || j
                  «       y)z„
        A L{Deferred} without a canceller, when cancelled and then
        errbacked, ignores multiple cancels thereafter.
        N)r    r©   r�   r–   rú   r†   r[   rÙ   r   r   rª   rB   rm   rQ  s      r9   Ú4test_noCancellerMultipleCancelsAfterCancelAndErrbackzKDeferredCancellerTests.test_noCancellerMultipleCancelsAfterCancelAndErrback	  s¶   € ô
 %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHØ×,Ñ,ˆà	�	‰	”,“.Ô!à×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHØ	�‰Œ
Ø�‰�n d×&9Ñ&9Õ:r;   c                óx  — t        «       }|j                  | j                  | j                  «       |j	                  «        | j
                  €J ‚| j                  | j
                  j                  t        j                  «       | j
                  }|j	                  «        | j                  || j
                  «       y)z·
        Calling cancel multiple times on a deferred with no canceller
        results in a L{defer.CancelledError}. Subsequent calls to cancel
        do not cause an error.
        N)r    r©   r�   r–   rú   r†   r[   rÙ   r   r   rm   rQ  s      r9   Útest_noCancellerMultipleCancelz5DeferredCancellerTests.test_noCancellerMultipleCancel	  s†   € ô %›JˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHØ×,Ñ,ˆØ	�‰Œ
Ø�‰�n d×&9Ñ&9Õ:r;   c                óÂ  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  «        ‰ j
                  €J ‚‰ j                  ‰ j
                  j                  t        j                  «       ‰ j
                  }|j	                  «        ‰ j                  |‰ j
                  «       ‰ j                  ‰ j                  d«       y)a,  
        Verify that calling cancel multiple times on a deferred with a
        canceller that does not errback results in a
        L{defer.CancelledError} and that subsequent calls to cancel do not
        cause an error and that after all that, the canceller was only
        called once.
        c                ó0   •— ‰xj                   dz  c_         y rD  ©rC  ©r#  r`   s    €r9   rú   zCDeferredCancellerTests.test_cancellerMultipleCancel.<locals>.cancel5	  ó   ø€ Ø×#Ò# qÑ(Ö#r;   rÐ  NrI   ©r#  r  r=   r|   )r    r©   r�   r–   rú   r†   r[   rÙ   r   r   rm   rC  )r`   rú   r#  rR  s   `   r9   Útest_cancellerMultipleCancelz3DeferredCancellerTests.test_cancellerMultipleCancel,	  s¥   ø€ õ	)ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHØ×,Ñ,ˆØ	�‰Œ
Ø�‰�n d×&9Ñ&9Ô:Ø×Ñ˜×0Ñ0°!Õ4r;   c                ó  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  «        ‰ j                  ‰ j                  d«       ‰ j                  €J ‚‰ j                  ‰ j                  j                  t        j                  «       ‰ j                  t        j                  |j                  d«       ‰ j                  t        j                  |j                  t        «       «       y)z±
        Verify that a L{Deferred} calls its specified canceller when
        it is cancelled, and that further call/errbacks raise
        L{defer.AlreadyCalledError}.
        c                ó0   •— ‰xj                   dz  c_         y rD  rZ  r[  s    €r9   rú   z;DeferredCancellerTests.test_simpleCanceller.<locals>.cancelI	  r\  r;   rÐ  rI   Nr]  )r    r©   r�   r–   rú   r[   rC  r†   rÙ   r   r   r°  r  rO   rª   r¯  ©r`   rú   r#  s   `  r9   Útest_simpleCancellerz+DeferredCancellerTests.test_simpleCancellerB	  s¹   ø€ õ	)ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×Ñ˜×0Ñ0°!Ô4Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÔHð 	×Ñœ%×2Ñ2°A·J±JÀÔEØ×Ñœ%×2Ñ2°A·I±I¼y»{ÕKr;   c                óš   ‡ ‡— dˆˆ fd„}t        |¬«      Š‰j                  ‰ j                  ‰ j                  «       ‰j	                  «        y)zQ
        Verify that a canceller is given the correct deferred argument.
        c                ó*   •— ‰j                  | ‰«       y r3   )rm   )rã   r#  r`   s    €€r9   rú   z8DeferredCancellerTests.test_cancellerArg.<locals>.cancel\	  s   ø€ Ø�M‰M˜"˜aÕ r;   rÐ  N)rã   r  r=   r|   )r    r©   r�   r–   rú   ra  s   ` @r9   Útest_cancellerArgz(DeferredCancellerTests.test_cancellerArgW	  s3   ù€ ö
	!ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰�
r;   c                ó^  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  d«       |j                  «        ‰ j                  ‰ j                  d«       ‰ j                  ‰ j                  «       ‰ j                  ‰ j                  d«       y)zo
        Test that cancelling a deferred after it has been callbacked does
        not cause an error.
        c                ób   •— ‰xj                   dz  c_         | j                  t        «       «       y rD  ©rC  rª   rB   r[  s    €r9   rú   z?DeferredCancellerTests.test_cancelAfterCallback.<locals>.canceli	  ó"   ø€ Ø×#Ò# qÑ(Õ#Ø�I‰I”l“nÕ%r;   rÐ  zbiff!r   Nr]  )r    r©   r�   r–   rO   rú   r[   rC  r�   r†   r„   ra  s   `  r9   Útest_cancelAfterCallbackz/DeferredCancellerTests.test_cancelAfterCallbackc	  s   ø€ õ	&ô $¨fÔ5ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�
‰
�7ÔØ	�‰Œ
Ø×Ñ˜×0Ñ0°!Ô4Ø×Ñ˜$×-Ñ-Ô.Ø×Ñ˜×-Ñ-¨wÕ7r;   c                ó¦  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  t        «       «       |j                  «        ‰ j                  ‰ j                  d«       ‰ j                  €J ‚‰ j                  ‰ j                  j                  t
        «       ‰ j                  ‰ j                  «       y)z†
        Test that cancelling a L{Deferred} after it has been errbacked does
        not result in a L{defer.CancelledError}.
        c                ób   •— ‰xj                   dz  c_         | j                  t        «       «       y rD  rh  r[  s    €r9   rú   z>DeferredCancellerTests.test_cancelAfterErrback.<locals>.cancel{	  ri  r;   rÐ  r   Nr]  )r    r©   r�   r–   rª   rB   rú   r[   rC  r†   rÙ   r�   r„   ra  s   `  r9   Útest_cancelAfterErrbackz.DeferredCancellerTests.test_cancelAfterErrbacku	  s™   ø€ õ	&ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�	‰	”,“.Ô!Ø	�‰Œ
Ø×Ñ˜×0Ñ0°!Ô4Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´<Ô@Ø×Ñ˜$×.Ñ.Õ/r;   c                ó>  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  «        ‰ j                  ‰ j                  d«       ‰ j                  €J ‚‰ j                  ‰ j                  j                  t        «       y)z?
        Test a canceller which errbacks its deferred.
        c                ób   •— ‰xj                   dz  c_         | j                  t        «       «       y rD  rh  r[  s    €r9   rú   zADeferredCancellerTests.test_cancellerThatErrbacks.<locals>.cancel�	  ri  r;   rÐ  rI   Nr]  )
r    r©   r�   r–   rú   r[   rC  r†   rÙ   rB   ra  s   `  r9   Útest_cancellerThatErrbacksz1DeferredCancellerTests.test_cancellerThatErrbacksˆ	  sw   ø€ õ
	&ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×Ñ˜×0Ñ0°!Ô4Ø×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´<Õ@r;   c                ó<  ‡ — dˆ fd„}t        |¬«      }|j                  ‰ j                  ‰ j                  «       |j	                  «        ‰ j                  ‰ j                  d«       ‰ j                  ‰ j                  d«       ‰ j                  ‰ j                  «       y)z<
        Test a canceller which calls its deferred.
        c                óR   •— ‰xj                   dz  c_         | j                  d«       y )NrI   úhello!)rC  rO   r[  s    €r9   rú   zBDeferredCancellerTests.test_cancellerThatCallbacks.<locals>.cancel�	  s    ø€ Ø×#Ò# qÑ(Õ#Ø�J‰J�xÕ r;   rÐ  rI   rs  Nr]  )
r    r©   r�   r–   rú   r[   rC  r„   r�   r†   ra  s   `  r9   Útest_cancellerThatCallbacksz2DeferredCancellerTests.test_cancellerThatCallbacks˜	  ss   ø€ õ
	!ô %¨vÔ6ˆØ	�‰�t—~‘~ t§}¡}Ô5Ø	�‰Œ
Ø×Ñ˜×0Ñ0°!Ô4Ø×Ñ˜×-Ñ-¨xÔ8Ø×Ñ˜$×-Ñ-Õ.r;   c                óÂ  ‡ ‡— dˆ fd„}dˆ fd„}t        |¬«      Št        |¬«      }|j                  d«       |j                  ˆfd„«       |j                  «        |j	                  ‰ j
                  ‰ j                  «       ‰ j                  ‰ j                  d«       ‰ j                  €J ‚‰ j                  ‰ j                  j                  t        j                  «       y)zÅ
        Verify that a Deferred, a, which is waiting on another Deferred, b,
        returned from one of its callbacks, will propagate
        L{defer.CancelledError} when a is cancelled.
        c                ó0   •— ‰xj                   dz  c_         y rD  rZ  r[  s    €r9   ÚinnerCancelzEDeferredCancellerTests.test_cancelNestedDeferred.<locals>.innerCancel¯	  r\  r;   c                ó(   •— ‰j                  d«       y ©NF)r]   r[  s    €r9   rú   z@DeferredCancellerTests.test_cancelNestedDeferred.<locals>.cancel²	  s   ø€ Ø�O‰O˜EÕ"r;   rÐ  Nc                ó   •— ‰S r3   rG   )rG  r1  s    €r9   rð   zBDeferredCancellerTests.test_cancelNestedDeferred.<locals>.<lambda>¸	  s   ø€  1€ r;   rI   r]  )r    rO   rœ   rú   r©   r�   r–   r[   rC  r†   rÙ   r   r   )r`   rw  rú   rÐ  r1  s   `   @r9   Útest_cancelNestedDeferredz0DeferredCancellerTests.test_cancelNestedDeferred¨	  s¦   ù€ õ	)õ	#ô %¨{Ô;ˆÜ$¨vÔ6ˆØ	�
‰
�4ÔØ	�‰“nÔ%Ø	�‰Œ
Ø	�‰�t—~‘~ t§}¡}Ô5à×Ñ˜×0Ñ0°!Ô4ð ×"Ñ"Ð.Ð.Ð.Ø×Ñ˜×,Ñ,×1Ñ1´5×3GÑ3GÕHr;   Nr€   )rG  r®   r=   r®   )rG  r®   r=   r|   )rn   r/   r=   r|   )rD   rE   rF   r‹   r  r�   r“   r–   rK  rM  rO  rS  rU  rW  r^  rb  re  rj  rm  rp  rt  r{  rG   r;   r9   rA  rA  ¹  sf   „ ó$ó7óó%ó$ó
0óLó"Ló";ó;ó$;ó5ó,Ló*
ó8ó$0ó&Aó /ô Ir;   rA  c                  óh   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zy)ÚLogTestsz+
    Test logging of unhandled errors.
    c                ód   — g | _         t        j                  | j                   j                  «       y)z<
        Add a custom observer to observer logging.
        N)Úcr,   r}   rZ   rŠ   s    r9   r‹   zLogTests.setUpÈ	  s   € ð (*ˆŒÜ�‰˜Ÿ™Ÿ™Õ&r;   c                óV   — t        j                  | j                  j                  «       y)z&
        Remove the observer.
        N)r,   ÚremoveObserverr  rZ   rŠ   s    r9   r  zLogTests.tearDownÏ	  s   € ô 	×Ñ˜4Ÿ6™6Ÿ=™=Õ)r;   c                óL   — | j                   D �cg c]
  }|d   sŒ	|‘Œ c}S c c}w )NÚisError©r  )r`   rï   s     r9   Ú_loggedErrorszLogTests._loggedErrorsÕ	  s    € ØŸ6™6Ö2�a Q y£\’Ò2Ð2ùÒ2s   �
!š!c                óº   — | j                  «       }| j                  t        |«      d«       |d   d   j                  t        «       | j                  t        «       y)zV
        Check the output of the log observer to see if the error is present.
        rÀ   rI   rO  N)r…  r[   r\   rN  r3  rl   )r`   Úc2s     r9   r+  zLogTests._checkØ	  sM   € ð ×ÑÓ!ˆØ×Ñœ˜R› !Ô$Ø
ˆ1‰ˆiÑ×ÑÔ/Ô0Ø×ÑÔ0Õ1r;   c                óž   — t        «       j                  d„ «      j                  d«       t        j                  «        | j                  «        y)zÚ
        Verify that when a L{Deferred} with no references to it is fired,
        and its final result (the one not handled by any callback) is an
        exception, that exception will be logged immediately.
        c                ó   — ddz  S r/  rG   r}  s    r9   rð   z(LogTests.test_errorLog.<locals>.<lambda>ç	  ó
   € ¨¨a©€ r;   rI   N)r    rœ   rO   ÚgcÚcollectr+  rŠ   s    r9   Útest_errorLogzLogTests.test_errorLogá	  s2   € ô 	‹
×ÑÑ/Ó0×9Ñ9¸!Ô<Ü
�
‰
ŒØ�‰�r;   c                ób   — dd„} |«        t        j                  «        | j                  «        y)zD
        Same as L{test_errorLog}, but with an inner frame.
        c                 ó^   — t        «       } | j                  d„ «       | j                  d«       y )Nc                ó   — ddz  S r/  rG   r}  s    r9   rð   z`LogTests.test_errorLogWithInnerFrameRef.<locals>._subErrorLogWithInnerFrameRef.<locals>.<lambda>ò	  ó
   €  A¨¡F€ r;   rI   )r    rœ   rO   r”  s    r9   Ú_subErrorLogWithInnerFrameRefzNLogTests.test_errorLogWithInnerFrameRef.<locals>._subErrorLogWithInnerFrameRefð	  s!   € Ü'›zˆAØ�M‰MÑ*Ô+Ø�J‰J�q�Mr;   Nr€   ©r‹  rŒ  r+  )r`   r’  s     r9   Útest_errorLogWithInnerFrameRefz'LogTests.test_errorLogWithInnerFrameRefë	  s!   € ó
	ñ
 	&Ô'Ü
�
‰
ŒØ�‰�r;   c                ób   — dd„} |«        t        j                  «        | j                  «        y)zQ
        Same as L{test_errorLogWithInnerFrameRef}, plus create a cycle.
        c                 óv   — t        «       } | fdd„}| j                  |«       | | _        | j                  d«       y )Nc                ó   — ddz  S r/  rG   )r~  r#  s     r9   ÚunusedCyclezgLogTests.test_errorLogWithInnerFrameCycle.<locals>._subErrorLogWithInnerFrameCycle.<locals>.unusedCycle
  s   € Ø˜A‘v�r;   rI   )r~  r5  r#  úDeferred[int]r=   r5  )r    rœ   Ú_drO   )r#  r˜  s     r9   Ú_subErrorLogWithInnerFrameCyclezRLogTests.test_errorLogWithInnerFrameCycle.<locals>._subErrorLogWithInnerFrameCycleþ	  s1   € Ü'›zˆAà78ô ð �M‰M˜+Ô&àˆAŒDØ�J‰J�q�Mr;   Nr€   r“  )r`   r›  s     r9   Ú test_errorLogWithInnerFrameCyclez)LogTests.test_errorLogWithInnerFrameCycleù	  s!   € ó
		ñ 	(Ô)Ü
�
‰
ŒØ�‰�r;   c                ó€  — t        «       j                  d„ «      j                  d«       t        j                  «        | j                  «        | j                  dt        | j                  «      «       t        j                  | j                  d   «      }|€J ‚d}| j                  |j                  |«      d|›�«       y)z�
        Verify that when a L{Deferred} with no references to it is fired,
        the logged message does not contain a repr of the failure object.
        c                ó   — ddz  S r/  rG   r}  s    r9   rð   z.LogTests.test_errorLogNoRepr.<locals>.<lambda>
  rŠ  r;   rI   rÀ   éÿÿÿÿNr{   ú Expected message starting with: )r    rœ   rO   r‹  rŒ  r+  r[   r\   r  r,   rv   r]   r~   )r`   ÚmsgrX  s      r9   Útest_errorLogNoReprzLogTests.test_errorLogNoRepr
  s“   € ô
 	‹
×ÑÑ/Ó0×9Ñ9¸!Ô<ä
�
‰
ŒØ�‰Œà×Ñ˜œC §¡›KÔ(Ü×#Ñ# D§F¡F¨2¡JÓ/ˆØˆÐˆØ0ˆØ�‰Ø�N‰N˜8Ó$Ø.¨x¨lÐ;õ	
r;   c                óD  — dd„} |«        t        j                  «        | j                  «        | j                  dt	        | j
                  «      «       t        j                  | j
                  d   «      }|€J ‚d}| j                  |j                  |«      d|›�«       y)z³
        Verify that when a L{Deferred} with no references to it is fired,
        the logged message includes debug info if debugging on the deferred
        is enabled.
        c                 ól   — t        «       } d| _        | j                  d„ «       | j                  d«       y )NTc                ó   — ddz  S r/  rG   r}  s    r9   rð   z?LogTests.test_errorLogDebugInfo.<locals>.doit.<locals>.<lambda>*
  r‘  r;   rI   )r    Údebugrœ   rO   r”  s    r9   Údoitz-LogTests.test_errorLogDebugInfo.<locals>.doit'
  s(   € Ü'›zˆAØˆAŒGØ�M‰MÑ*Ô+Ø�J‰J�q�Mr;   rÀ   rŸ  Nz
(debug:  Ir   r€   )
r‹  rŒ  r+  r[   r\   r  r,   rv   r]   r~   )r`   r§  r¡  rX  s       r9   Útest_errorLogDebugInfozLogTests.test_errorLogDebugInfo 
  s�   € ó	ñ 	ŒÜ
�
‰
ŒØ�‰Œà×Ñ˜œC §¡›KÔ(Ü×#Ñ# D§F¡F¨2¡JÓ/ˆØˆÐˆØˆØ�‰Ø�N‰N˜8Ó$Ø.¨x¨lÐ;õ	
r;   c                óª  — t        «       }|j                  d„ «       |j                  d«       g }g }|j                  |j                  |j                  «       | j                  |g «       | j                  t        |«      d«       |d   j                  t        «       ~~~t        j                  «        | j                  | j                  «       g «       y)z¿
        If one Deferred with an error result is returned from a callback on
        another Deferred, when the first Deferred is garbage collected it does
        not log its error.
        c                ó>   — t        j                  t        d«      «      S )NÚzoop)r   r'  rj   r<  s    r9   rð   z3LogTests.test_chainedErrorCleanup.<locals>.<lambda>A
  s   € ¤%§*¡*¬\¸&Ó-AÓ"B€ r;   NrI   r   )r    rœ   rO   r©   rZ   r[   r\   rN  r¯  r‹  rŒ  r…  )r`   r#  re  rr   s       r9   Útest_chainedErrorCleanupz!LogTests.test_chainedErrorCleanup:
  s§   € ô %›JˆØ	�‰ÑBÔCØ	�
‰
�4Ôð !ˆØ "ˆØ	�‰�w—~‘~ v§}¡}Ô5Ø×Ñ˜ "Ô%Ø×Ñœ˜V› aÔ(Øˆq‰	�‰”yÔ!ð �V˜Qô 	�
‰
Œà×Ñ˜×+Ñ+Ó-¨rÕ2r;   c                óö   ‡— t        j                  t        d«      «      }t        «       Š|€J ‚|j	                  ˆfd„«       dxŠ}t        j                  «        | j                  | j                  «       g «       y)z¼
        If a Deferred with a failure result has an errback which chains it to
        another Deferred, the initial failure is cleared by the errback so it is
        not logged.
        zoh noNc                ó   •— ‰S r3   rG   )rV  Úgoods    €r9   rð   z6LogTests.test_errorClearedByChaining.<locals>.<lambda>a
  s   ø€  t€ r;   )	r   r'  r¯  r    rY   r‹  rŒ  r[   r…  )r`   Úbadr¯  s     @r9   Útest_errorClearedByChainingz$LogTests.test_errorClearedByChainingV
  sd   ø€ ô ).¯
©
´9¸WÓ3EÓ(FˆÜ)1«ˆàˆÐˆØ�‰Ó+Ô,ð ÐˆˆsÜ
�
‰
ŒØ×Ñ˜×+Ñ+Ó-¨rÕ2r;   Nr€   )r=   zList[Dict[str, Any]])rD   rE   rF   rf   r‹   r  r…  r+  r�  r”  rœ  r¢  r¨  r¬  r±  rG   r;   r9   r}  r}  Ã	  s>   „ ñó'ó*ó3ó2óóóó(
ó&
ó43ô83r;   r}  c                  ó,   — e Zd Zdd„Zdd„Zdd„Zdd„Zy)ÚDeferredListEmptyTestsc                ó   — d| _         y r�   )ÚcallbackRanrŠ   s    r9   r‹   zDeferredListEmptyTests.setUpj
  s
   € ØˆÕr;   c                óP   — t        g «      }|j                  | j                  «       y)zTesting empty DeferredList.N)r"   rœ   Úcb_empty)r`   rÉ   s     r9   ÚtestDeferredListEmptyz,DeferredListEmptyTests.testDeferredListEmptym
  s   € ä9EÀbÓ9IˆØ
�‰�t—}‘}Õ%r;   c                ó6   — d| _         | j                  g |«       y rD  )rµ  r[   )r`   Úress     r9   r·  zDeferredListEmptyTests.cb_emptyr
  s   € ØˆÔØ×Ñ˜˜SÕ!r;   c                ó<   — | j                  | j                  d«       y )NzCallback was never run.)r]   rµ  rŠ   s    r9   r  zDeferredListEmptyTests.tearDownv
  s   € Ø�‰˜×(Ñ(Ð*CÕDr;   Nr€   )rº  zList[Tuple[bool, object]]r=   r|   )rD   rE   rF   r‹   r¸  r·  r  rG   r;   r9   r³  r³  i
  s   „ óó&ó
"ôEr;   r³  c                  ól   — e Zd Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zy)ÚOtherPrimitivesTestsc                ó.   — | xj                   dz  c_         y rD  ©Úcounter©r`   ro   s     r9   Ú_incrzOtherPrimitivesTests._incr{
  s   € Ø�Š˜ÑŽr;   c                ó   — d| _         y r�   r¿  rŠ   s    r9   r‹   zOtherPrimitivesTests.setUp~
  s	   € Øˆ�r;   c                óT  ‡
— t        «       }|j                  «       j                  | j                  «       | j	                  |j
                  «       | j                  | j                  d«       |j                  «       j                  | j                  «       | j	                  |j
                  «       | j                  | j                  d«       |j                  «        | j	                  |j
                  «       | j                  | j                  d«       |j                  «        | j                  |j
                  «       | j                  | j                  d«       | j                  t        |j                  «       t        «       }t        «       }t        «       }d Š
dd	ˆ
fd„}|j                  |||¬«      }| j	                  |j
                  «       | j                  ‰
|«       |j                  |«       |j                  «       j                  | j                  «       | j	                  |j
                  «       | j                  | j                  d«       |j                  |«       | j                  ‰
|«       | j	                  |j
                  «       | j                  | j                  d«       |j                  «       j!                  |«      }|j#                  «        | j%                  ‰
t&        «       | j                  t)        t&        ‰
«      j*                  t,        j.                  «       |j                  «        | j                  |j
                  «       d
d„}dd„}	t1        |j                  |«      t        t2           «       t1        |j                  |	«      t        t2           «       y )NrI   rÀ   c                ó   •— | Š|S r3   rG   )ÚresultValueÚreturnValuero   s     €r9   Úhelperz-OtherPrimitivesTests.testLock.<locals>.helperœ
  s   ø€ à ˆFØÐr;   )rÆ  rÇ  rî  c                 ó,   — t        j                  d«      S rô  ©r   r   rG   r;   r9   r¨  z1OtherPrimitivesTests.testLock.<locals>.returnsIntº
  s   € Ü—=‘= Ó#Ð#r;   c               “  ó   K  — y­wrD  rG   rG   r;   r9   ÚreturnsCoroIntz5OtherPrimitivesTests.testLock.<locals>.returnsCoroInt½
  r™  rš  r3   )rÆ  r<   rÇ  r<   r=   r<   )r=   r™  r›  )r#   Úacquirerœ   rÂ  r]   Úlockedr[   rÀ  Úreleaser  r°  r‹  Úrunr<   r    rO   r>  rú   r4  r/   r   rÙ   r   r   r   r5  )r`   ÚlockÚfirstUniqueÚsecondUniqueÚcontrolDeferredrÈ  ÚresultDeferredr#  r¨  rÌ  ro   s             @r9   ÚtestLockzOtherPrimitivesTests.testLock�
  s‚  ø€ Ü‹~ˆØ�‰‹×"Ñ" 4§:¡:Ô.Ø�‰˜Ÿ™Ô$Ø×Ñ˜Ÿ™ qÔ)à�‰‹×"Ñ" 4§:¡:Ô.Ø�‰˜Ÿ™Ô$Ø×Ñ˜Ÿ™ qÔ)à�‰ŒØ�‰˜Ÿ™Ô$Ø×Ñ˜Ÿ™ qÔ)à�‰ŒØ×Ñ˜Ÿ™Ô%Ø×Ñ˜Ÿ™ qÔ)à×Ñœ) T§X¡XÔ.ä“hˆÜ“xˆä,4«Jˆà#'ˆö	ð
 Ÿ™Ø ¸ð "ó 
ˆð 	�‰˜Ÿ™Ô$Ø×Ñ˜ Ô-à×"Ñ" 6Ô*à�‰‹×"Ñ" 4§:¡:Ô.Ø�‰˜Ÿ™Ô$Ø×Ñ˜Ÿ™ qÔ)à× Ñ  Ô.Ø×Ñ˜ Ô.Ø�‰˜Ÿ™Ô$Ø×Ñ˜Ÿ™ qÔ)à�L‰L‹N×"Ñ" 6Ó*ˆØ	�‰Œ
Ø×Ñ˜f¤gÔ.Ø×Ñœœg vÓ.×3Ñ3´U×5IÑ5IÔJà�‰ŒØ×Ñ˜Ÿ™Ô%ó	$ó	ô 	�D—H‘H˜ZÓ(¬(´3©-Ô8Ü�D—H‘H˜^Ó,¬h´s©mÕ<r;   c                óˆ   ‡ — dˆ fd„}t        «       }|j                  «       }|j                  |«       |j                  «        y)zŠ
        When canceling a L{Deferred} from a L{DeferredLock} that already
        has the lock, the cancel should have no effect.
        c                ó(   •— ‰j                  d«       y ©NzUnexpected errback call!©r'  ©r8   r`   s    €r9   ÚfailOnErrbackzHOtherPrimitivesTests.test_cancelLockAfterAcquired.<locals>.failOnErrbackÉ
  ó   ø€ Ø�I‰IÐ0Õ1r;   N©r8   r/   r=   r|   )r#   rÍ  rY   rú   )r`   rÜ  rÑ  r#  s   `   r9   Útest_cancelLockAfterAcquiredz1OtherPrimitivesTests.test_cancelLockAfterAcquiredÃ
  s1   ø€ õ	2ô ‹~ˆØ�L‰L‹NˆØ	�‰�]Ô#Ø	�‰�
r;   c                ó¸   — t        «       }|j                  «        |j                  «       }|j                  «        | j                  |t        j
                  «       y)z×
        When canceling a L{Deferred} from a L{DeferredLock} that does not
        yet have the lock (i.e., the L{Deferred} has not fired), the cancel
        should cause a L{defer.CancelledError} failure.
        N)r#   rÍ  rú   rd   r   r   )r`   rÑ  r#  s      r9   Útest_cancelLockBeforeAcquiredz2OtherPrimitivesTests.test_cancelLockBeforeAcquiredÑ
  s>   € ô ‹~ˆØ�‰ŒØ�L‰L‹NˆØ	�‰Œ
Ø×#Ñ# A¤u×';Ñ';Õ<r;   c                ó¤  ‡‡‡— d}t        |«      }t        «       Šd Šd	ˆˆfd„}g }t        «       }|j                  ||¬«      }|j	                  |j
                  «       |j	                  | j                  «       | j                  |g «       | j                  ‰|«       ‰j                  d «       | j                  |j                  «       «       | j                  | j                  d«       d| _        t        dd|z   «      D ]G  }|j                  «       j	                  | j                  «       | j                  | j                  |«       ŒI g Šd
ˆfd„}d
ˆfd„}	|j                  «       j                  ||	«      }
|
j                  «        | j                  ‰dg«       |j                  «       j	                  | j                  «       | j                  | j                  |«       |j!                  «        | j                  | j                  |dz   «       t        dd|z   «      D ]1  }|j!                  «        | j                  | j                  |dz   «       Œ3 y )Nró  c                ó   •— | Š‰S r3   rG   )ÚargrÔ  Ú	helperArgs    €€r9   rÈ  z2OtherPrimitivesTests.testSemaphore.<locals>.helperå
  s   ø€ àˆIØ"Ð"r;   )rä  rI   r   c                ó(   •— ‰j                  d«       y ry  rÍ   ©r<  r  s    €r9   r'  z0OtherPrimitivesTests.testSemaphore.<locals>.failü
  s   ø€ Ø�N‰N˜5Õ!r;   c                ó(   •— ‰j                  d«       y rÿ  rÍ   rç  s    €r9   r   z3OtherPrimitivesTests.testSemaphore.<locals>.succeedÿ
  s   ø€ Ø�N‰N˜4Õ r;   T)rä  r<   r=   rá  )r<  r<   r=   r|   )r%   r    r<   rÐ  rœ   rZ   rÂ  r[   rO   r�   rl  rÀ  rk  rÍ  r©   rú   rÏ  )r`   ÚNÚsemrÈ  re  ÚuniqueObjectrÕ  Úir'  r   r#  rÔ  rå  r  s              @@@r9   ÚtestSemaphorez"OtherPrimitivesTests.testSemaphoreÝ
  sÖ  ú€ ØˆÜ Ó"ˆä*2«*ˆà ˆ	ö	#ð
 !#ˆÜ“xˆØŸ™ ¨\˜Ó:ˆØ×"Ñ" 7§>¡>Ô2Ø×"Ñ" 4§:¡:Ô.Ø×Ñ˜ "Ô%Ø×Ñ˜ LÔ1Ø× Ñ  Ô&Ø×Ñ˜'Ÿ+™+›-Ô(Ø×Ñ˜Ÿ™ qÔ)àˆŒÜ�q˜!˜a™%“ò 	.ˆAØ�K‰K‹M×%Ñ% d§j¡jÔ1Ø×Ñ˜TŸ\™\¨1Õ-ð	.ð ˆõ	"õ	!ð �K‰K‹M×&Ñ& t¨WÓ5ˆØ	�‰Œ
Ø×Ñ˜ 4 &Ô)à�‰‹×!Ñ! $§*¡*Ô-Ø×Ñ˜Ÿ™ qÔ)à�‰ŒØ×Ñ˜Ÿ™ q¨1¡uÔ-ä�q˜!˜a™%“ò 	2ˆAØ�K‰KŒMØ×Ñ˜TŸ\™\¨1¨q©5Õ1ñ	2r;   c                óp   — | j                  t        t        d«       | j                  t        t        d«       y)zz
        If the token count passed to L{DeferredSemaphore} is less than one
        then L{ValueError} is raised.
        r   rŸ  N)r°  rR  r%   rŠ   s    r9   Útest_semaphoreInvalidTokensz0OtherPrimitivesTests.test_semaphoreInvalidTokens  s*   € ð
 	×Ñœ*Ô&7¸Ô;Ø×Ñœ*Ô&7¸Õ<r;   c                óŠ   ‡ — dˆ fd„}t        d«      }|j                  «       }|j                  |«       |j                  «        y)z”
        When canceling a L{Deferred} from a L{DeferredSemaphore} that
        already has the semaphore, the cancel should have no effect.
        c                ó(   •— ‰j                  d«       y rÙ  rÚ  rÛ  s    €r9   rÜ  zMOtherPrimitivesTests.test_cancelSemaphoreAfterAcquired.<locals>.failOnErrback  rÝ  r;   rI   NrÞ  )r%   rÍ  rY   rú   )r`   rÜ  rê  r#  s   `   r9   Ú!test_cancelSemaphoreAfterAcquiredz6OtherPrimitivesTests.test_cancelSemaphoreAfterAcquired  s4   ø€ õ	2ô   Ó"ˆØ�K‰K‹MˆØ	�‰�]Ô#Ø	�‰�
r;   c                óº   — t        d«      }|j                  «        |j                  «       }|j                  «        | j                  |t        j
                  «       y)zá
        When canceling a L{Deferred} from a L{DeferredSemaphore} that does
        not yet have the semaphore (i.e., the L{Deferred} has not fired),
        the cancel should cause a L{defer.CancelledError} failure.
        rI   N)r%   rÍ  rú   rd   r   r   )r`   rê  r#  s      r9   Ú"test_cancelSemaphoreBeforeAcquiredz7OtherPrimitivesTests.test_cancelSemaphoreBeforeAcquired&  sA   € ô   Ó"ˆØ�‰ŒØ�K‰K‹MˆØ	�‰Œ
Ø×#Ñ# A¤u×';Ñ';Õ<r;   c                ó   — d\  }}t        ||«      }g }t        |«      D ]+  }|j                  «       j                  |j                  «       Œ- | j                  t        j                  |j                  «       t        |«      D ]:  }|j                  |«       | j                  |t        t        |dz   «      «      «       Œ< t        |«      D ]:  }|j                  ||z   «       | j                  |t        t        |«      «      «       Œ< | j                  t        j                  |j                  d «       g }t        |«      D ]V  }|j                  «       j                  |j                  «       | j                  |t        t        |||z   dz   «      «      «       ŒX t        «       }g }t        |«      D ]+  }|j                  «       j                  |j                  «       Œ- t        |«      D ]  }|j                  |«       Œ | j                  |t        t        |«      «      «       t        d¬«      }| j                  t        j                  |j                  d «       t        d¬«      }| j                  t        j                  |j                  «       y )N)rÀ   rÀ   rI   r   )Úsize)Úbacklog)r$   rk  Úgetrœ   rZ   r°  r   ÚQueueUnderflowÚputr[   ÚlistÚQueueOverflow)r`   ré  ÚMÚqueueÚgottenrì  s         r9   Ú	testQueuezOtherPrimitivesTests.testQueue2  s  € Ø‰ˆˆ1Ü$1°!°QÓ$7ˆàˆä�q“ò 	3ˆAØ�I‰I‹K×#Ñ# F§M¡MÕ2ð	3à×Ñœ%×.Ñ.°·	±	Ô:ä�q“ò 	9ˆAØ�I‰I�aŒLØ×Ñ˜V¤T¬%°°A±«,Ó%7Õ8ð	9ô �q“ò 	5ˆAØ�I‰I�a˜!‘eÔØ×Ñ˜V¤T¬%°«(£^Õ4ð	5ð 	×Ñœ%×-Ñ-¨u¯y©y¸$Ô?àˆÜ�q“ò 	@ˆAØ�I‰I‹K×#Ñ# F§M¡MÔ2Ø×Ñ˜V¤T¬%°°1°q±5¸1±9Ó*=Ó%>Õ?ð	@ô “ˆØˆÜ�q“ò 	3ˆAØ�I‰I‹K×#Ñ# F§M¡MÕ2ð	3ä�q“ò 	ˆAØ�I‰I�a�Lð	à×Ñ˜¤¤e¨A£h£Ô0ä 1Ô%ˆØ×Ñœ%×-Ñ-¨u¯y©y¸$Ô?ä aÔ(ˆØ×Ñœ%×.Ñ.°·	±	Õ:r;   c                óª   ‡ — dˆ fd„}t        «       }|j                  «       }|j                  |«       |j                  d«       |j	                  «        y)z‹
        When canceling a L{Deferred} from a L{DeferredQueue} that already has
        a result, the cancel should have no effect.
        c                ó(   •— ‰j                  d«       y rÙ  rÚ  rÛ  s    €r9   rÜ  zOOtherPrimitivesTests.test_cancelQueueAfterSynchronousGet.<locals>.failOnErrback]  rÝ  r;   NrÞ  )r$   rø  rY   rú  rú   )r`   rÜ  rþ  r#  s   `   r9   Ú#test_cancelQueueAfterSynchronousGetz8OtherPrimitivesTests.test_cancelQueueAfterSynchronousGetW  s<   ø€ õ	2ô &3£_ˆØ�I‰I‹KˆØ	�‰�]Ô#Ø�	‰	�$ŒØ	�‰�
r;   c                ó<  ‡ ‡— t        «       Š‰j                  «       }|j                  «        ‰ j                  |t        j
                  «       dˆˆ fd„}|j                  |«       g }|j                  |j                  «       ‰ j                  t        |«      d«       y)a  
        When canceling a L{Deferred} from a L{DeferredQueue} that does not
        have a result (i.e., the L{Deferred} has not fired), the cancel
        causes a L{defer.CancelledError} failure. If the queue has a result
        later on, it doesn't try to fire the deferred.
        c                óz   •— ‰j                  d «       ‰j                  «       j                  ‰j                  d «      S r3   )rú  rø  rœ   rm   )Úignorerþ  r`   s    €€r9   r·   z9OtherPrimitivesTests.test_cancelQueueAfterGet.<locals>.cbr  s-   ø€ ð �I‰I�dŒOØ—9‘9“;×*Ñ*¨4¯=©=¸$Ó?Ð?r;   rI   N)r  r<   r=   rá  )
r$   rø  rú   rd   r   r   rœ   rZ   r[   r\   )r`   r#  r·   Údonerþ  s   `   @r9   Útest_cancelQueueAfterGetz-OtherPrimitivesTests.test_cancelQueueAfterGetf  ss   ù€ ô &3£_ˆØ�I‰I‹KˆØ	�‰Œ
Ø×#Ñ# A¤u×';Ñ';Ô<ö	@ð 	
�‰�bÔØˆØ	�‰�d—k‘kÔ"Ø×Ñœ˜T› AÕ&r;   Nr  r€   )rD   rE   rF   rÂ  r‹   rÖ  rß  rá  rí  rï  rò  rô  r   r  r  rG   r;   r9   r½  r½  z
  sB   „ óóó@=óDó
=ó12óf=óó
=ó#;óJô'r;   r½  c                  óX   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zy)ÚDeferredFilesystemLockTestsz8
    Test the behavior of L{DeferredFilesystemLock}
    c                óv   — t        «       | _        t        | j                  «       | j                  ¬«      | _        y )N)Ú	scheduler)r+   Úclockr!   ÚmktemprÑ  rŠ   s    r9   r‹   z!DeferredFilesystemLockTests.setUpƒ  s#   € Ü“WˆŒ
Ü*¨4¯;©;«=ÀDÇJÁJÔOˆ�	r;   c                ó:   — | j                   j                  d¬«      S )zI
        Test that the lock can be acquired when no lock is held
        rI   ©Útimeout)rÑ  ÚdeferUntilLockedrŠ   s    r9   Útest_waitUntilLockedWithNoLockz:DeferredFilesystemLockTests.test_waitUntilLockedWithNoLock‡  s   € ð �y‰y×)Ñ)°!Ð)Ó4Ð4r;   c                ó  — | j                  | j                  j                  «       «       | j                  j                  d¬«      }| j                  |t        j
                  «       | j                  j                  dgdz  «       |S )zs
        Test that the lock can not be acquired when the lock is held
        for longer than the timeout.
        g      @r  rI   r€  )r]   rÑ  r  ÚassertFailurer   ÚTimeoutErrorr  Úpumpr8  s     r9   Ú%test_waitUntilLockedWithTimeoutLockedzADeferredFilesystemLockTests.test_waitUntilLockedWithTimeoutLocked�  sc   € ð
 	�‰˜Ÿ	™	Ÿ™Ó(Ô)à�I‰I×&Ñ&¨sÐ&Ó3ˆØ×Ñ˜1œe×0Ñ0Ô1à�
‰
�‰˜˜˜b™Ô!àˆr;   c                ó^  ‡ — dˆ fd„}‰ j                  ‰ j                  j                  «       «       ‰ j                  j                  d‰ j                  j                  «       ‰ j                  j                  d¬«      }|j                  |«       ‰ j                  j                  dgdz  «       |S )z|
        Test that a lock can be acquired while a lock is held
        but the lock is unlocked before our timeout.
        c                óf   •— | j                  t        j                  «       ‰j                  d«       y )NzShould not have timed out)rN  r   r  r'  rÛ  s    €r9   Ú	onTimeoutzVDeferredFilesystemLockTests.test_waitUntilLockedWithTimeoutUnlocked.<locals>.onTimeout¡  s"   ø€ Ø�F‰F”5×%Ñ%Ô&Ø�I‰IÐ1Õ2r;   rI   r€  r  rÞ  )r]   rÑ  r  Ú	callLaterÚunlockr  rY   r  )r`   r  r#  s   `  r9   Ú'test_waitUntilLockedWithTimeoutUnlockedzCDeferredFilesystemLockTests.test_waitUntilLockedWithTimeoutUnlocked›  s}   ø€ õ	3ð 	�‰˜Ÿ	™	Ÿ™Ó(Ô)à�
‰
×Ñ˜Q §	¡	× 0Ñ 0Ô1Ø�I‰I×&Ñ&¨rÐ&Ó2ˆØ	�‰�YÔà�
‰
�‰˜˜˜b™Ô!àˆr;   c                óv   — t        | j                  «       «      }| j                  |j                  t        «       y)zE
        Test that the default scheduler is set up properly.
        N)r!   r  r[   Ú
_schedulerr   ©r`   rÑ  s     r9   Útest_defaultSchedulerz1DeferredFilesystemLockTests.test_defaultScheduler¯  s(   € ô & d§k¡k£mÓ4ˆà×Ñ˜Ÿ™¬'Õ2r;   c                óx  — | j                   j                  «        | j                  j                  d| j                   j                  «       | j                   j	                  «       }| j                   j	                  «       }| j                  |t        j                  «       | j                  j                  d«       |S )z|
        Test that an appropriate exception is raised when attempting
        to use deferUntilLocked concurrently.
        rI   )	rÑ  r  r  r  r  r  r   ÚAlreadyTryingToLockErrorÚadvancer@  s      r9   Útest_concurrentUsagez0DeferredFilesystemLockTests.test_concurrentUsage·  s�   € ð
 	�	‰	�‰ÔØ�
‰
×Ñ˜Q §	¡	× 0Ñ 0Ô1à�Y‰Y×'Ñ'Ó)ˆØ�Y‰Y×'Ñ'Ó)ˆà×Ñ˜2œu×=Ñ=Ô>à�
‰
×Ñ˜1Ôàˆ	r;   c                ó4  ‡ — dˆ fd„}‰ j                   j                  «        ‰ j                  j                  d‰ j                   j                  «       ‰ j                   j	                  «       }|j                  |«       ‰ j                  j                  d«       |S )zO
        Test that a DeferredFilesystemLock can be used multiple times
        c                óp   •— ‰j                   j                  «        ‰j                   j                  «       }|S r3   )rÑ  r  r  )r
  r#  r`   s     €r9   ÚlockAquiredzDDeferredFilesystemLockTests.test_multipleUsages.<locals>.lockAquiredÍ  s*   ø€ Ø�I‰I×ÑÔØ—	‘	×*Ñ*Ó,ˆAØˆHr;   rI   )r
  r<   r=   rá  )rÑ  r  r  r  r  rœ   r%  )r`   r)  r#  s   `  r9   Útest_multipleUsagesz/DeferredFilesystemLockTests.test_multipleUsagesÈ  sk   ø€ õ
	ð
 	�	‰	�‰ÔØ�
‰
×Ñ˜Q §	¡	× 0Ñ 0Ô1à�I‰I×&Ñ&Ó(ˆØ	�‰�kÔ"à�
‰
×Ñ˜1Ôàˆr;   c                óˆ  — | j                   j                  «        | j                   j                  «       }| j                   j                  }|€J ‚|j                  «        | j	                  |j                  «       «       | j                  | j                   j                  «       | j                  |t        j                  «       y)z°
        When cancelling a L{Deferred} returned by
        L{DeferredFilesystemLock.deferUntilLocked}, the
        L{DeferredFilesystemLock._tryLockCall} is cancelled.
        N)
rÑ  r  Ú_tryLockCallrú   r  Úactiver�   rû   r   r   )r`   rQ   ÚtryLockCalls      r9   Útest_cancelDeferUntilLockedz7DeferredFilesystemLockTests.test_cancelDeferUntilLockedÜ  sŽ   € ð 	�	‰	�‰ÔØ—9‘9×-Ñ-Ó/ˆØ—i‘i×,Ñ,ˆØÐ&Ð&Ð&Ø�‰ÔØ×Ñ˜×+Ñ+Ó-Ô.Ø×Ñ˜$Ÿ)™)×0Ñ0Ô1Ø×Ñ˜X¤u×';Ñ';Õ<r;   c                óŒ  — | j                   j                  «        | j                   j                  d¬«      }| j                   j                  }|€J ‚|j                  «        | j	                  |j                  «       «       | j                  | j                   j                  «       | j                  |t        j                  «       y)z®
        When cancel a L{Deferred} returned by
        L{DeferredFilesystemLock.deferUntilLocked}, if the timeout is
        set, the timeout call will be cancelled.
        rI   r  N)
rÑ  r  Ú_timeoutCallrú   r  r-  r�   rû   r   r   )r`   rQ   ÚtimeoutCalls      r9   Ú&test_cancelDeferUntilLockedWithTimeoutzBDeferredFilesystemLockTests.test_cancelDeferUntilLockedWithTimeoutë  s“   € ð 	�	‰	�‰ÔØ—9‘9×-Ñ-°aÐ-Ó8ˆØ—i‘i×,Ñ,ˆØÐ&Ð&Ð&Ø�‰ÔØ×Ñ˜×+Ñ+Ó-Ô.Ø×Ñ˜$Ÿ)™)×0Ñ0Ô1Ø×Ñ˜X¤u×';Ñ';Õ<r;   Nr€   )r=   rá  )rD   rE   rF   rf   r‹   r  r  r  r"  r&  r*  r/  r3  rG   r;   r9   r
  r
  ~  s5   „ ñóPó5óóó(3óó"ó(=ô=r;   r
  c                 ó   — y)zj
    Private function to be used to pass as an alternate onTimeoutCancel value
    to timeoutDeferred
    Ú
OVERRIDDENrG   )ÚvÚts     r9   Ú_overrideFuncr8  û  s   € ð
 r;   c                  ó    — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)ÚDeferredAddTimeoutTestsz7
    Tests for the function L{Deferred.addTimeout}
    c                óÔ   — t        «       }|j                  dt        «       «       |j                  d„ «       |j	                  d«       | j                  d| j                  |«      «       y)zu
        L{Deferred.addTimeout} returns its own L{Deferred} so it
        can be called in a callback chain.
        r|  c                 ó   — y)Nr  rG   r0  s    r9   rð   z?DeferredAddTimeoutTests.test_timeoutChainable.<locals>.<lambda>  rñ   r;   Nr  )r    Ú
addTimeoutr+   rœ   rO   r[   r  r8  s     r9   Útest_timeoutChainablez-DeferredAddTimeoutTests.test_timeoutChainable  sO   € ô
 %›JˆØ	�‰�Qœ›Ô Ø	�‰Ñ&Ô'Ø	�
‰
�4ÔØ×Ñ˜ ×!5Ñ!5°aÓ!8Õ9r;   c                óJ  ‡‡— t        «       }t        «       }|j                  d|«       t        «       ŠdŠdˆˆfd„}|j                  |«       |j	                  d«       | j                  d‰«       | j                  ‰d«       |j                  d«       | j                  ‰«       y)zÊ
        The L{Deferred} callbacks with the result if it succeeds before
        the timeout. No cancellation happens after the callback either,
        which could also cancel inner deferreds.
        r€  Nre  c                ó   •— | Š‰S r3   rG   ©re  ÚdCallbackedÚinnerDeferreds    €€r9   Ú
onCallbackzKDeferredAddTimeoutTests.test_successResultBeforeTimeout.<locals>.onCallback"  ó   ø€ à!ˆKØ Ð r;   r�  ©re  r®   r=   rá  )	r+   r    r=  rœ   rO   ÚassertIsNotr[   r%  r  ©r`   r  r#  rD  rB  rC  s       @@r9   Útest_successResultBeforeTimeoutz7DeferredAddTimeoutTests.test_successResultBeforeTimeout  sŒ   ù€ ô “ˆÜ#›:ˆØ	�‰�R˜Ôô )1«
ˆØ%)ˆö	!ð
 	
�‰�jÔ!Ø	�
‰
�9Ôð 	×Ñ˜˜{Ô+Ø×Ñ˜ iÔ0ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                óV  ‡‡— t        «       }t        «       }|j                  d|t        ¬«       t        «       ŠdŠdˆˆfd„}|j	                  |«       |j                  d«       | j                  d‰«       | j                  ‰d«       |j                  d«       | j                  ‰«       y)a  
        The L{Deferred} callbacks with the result if it succeeds before
        the timeout, even if a custom C{onTimeoutCancel} function is provided.
        No cancellation happens after the callback either, which could also
        cancel inner deferreds.
        r€  ©ÚonTimeoutCancelNre  c                ó   •— | Š‰S r3   rG   rA  s    €€r9   rD  zQDeferredAddTimeoutTests.test_successResultBeforeTimeoutCustom.<locals>.onCallbackD  rE  r;   r�  rF  )
r+   r    r=  r8  rœ   rO   rG  r[   r%  r  rH  s       @@r9   Ú%test_successResultBeforeTimeoutCustomz=DeferredAddTimeoutTests.test_successResultBeforeTimeoutCustom4  s�   ù€ ô “ˆÜ#›:ˆØ	�‰�R˜´ˆÔ>ô )1«
ˆØ%)ˆö	!ð
 	
�‰�jÔ!Ø	�
‰
�9Ôð 	×Ñ˜˜{Ô+Ø×Ñ˜ iÔ0ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                ó„  ‡‡— t        «       }t        «       }|j                  d|«       t        «       ŠdŠt        d«      }dˆˆfd„}|j	                  |«       |j                  |«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  |«       |j                  d«       | j                  ‰«       y)zÆ
        The L{Deferred} errbacks with the failure if it fails before the
        timeout. No cancellation happens after the errback either, which
        could also cancel inner deferreds.
        r€  Nr'  c                ó   •— | Š‰S r3   rG   ©r8   Ú
dErrbackedrC  s    €€r9   Ú	onErrbackzDDeferredAddTimeoutTests.test_failureBeforeTimeout.<locals>.onErrbackf  ó   ø€ àˆJØ Ð r;   r�  ©r8   r/   r=   rá  )r+   r    r=  rR  rY   rª   r4  r/   rm   r_   r%  r  ©r`   r  r#  rn   rS  rR  rC  s        @@r9   Útest_failureBeforeTimeoutz1DeferredAddTimeoutTests.test_failureBeforeTimeoutV  s¦   ù€ ô “ˆÜ$›JˆØ	�‰�R˜Ôô )1«
ˆØ(,ˆ
Ü˜6Ó"ˆö	!ð
 	
�‰�YÔØ	�	‰	�%Ôð Ð%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø�‰�j×&Ñ&¨Ô.ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                ó�  ‡‡— t        «       }t        «       }|j                  d|t        ¬«       t        «       ŠdŠt	        d«      }dˆˆfd„}|j                  |«       |j                  |«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  |«       |j                  d«       | j                  ‰«       y)a  
        The L{Deferred} errbacks with the failure if it fails before the
        timeout, even if using a custom C{onTimeoutCancel} function.
        No cancellation happens after the errback either, which could also
        cancel inner deferreds.
        r€  rK  Nr'  c                ó   •— | Š‰S r3   rG   rQ  s    €€r9   rS  zJDeferredAddTimeoutTests.test_failureBeforeTimeoutCustom.<locals>.onErrbackŠ  rT  r;   r�  rU  )r+   r    r=  r8  rR  rY   rª   r4  r/   rm   r_   r%  r  rV  s        @@r9   Útest_failureBeforeTimeoutCustomz7DeferredAddTimeoutTests.test_failureBeforeTimeoutCustomy  sª   ù€ ô “ˆÜ$›JˆØ	�‰�R˜´ˆÔ>ô )1«
ˆØ(,ˆ
Ü˜6Ó"ˆö	!ð
 	
�‰�YÔØ	�	‰	�%Ôð Ð%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø�‰�j×&Ñ&¨Ô.ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                óÔ   — t        «       }t        «       }|j                  d|«       | j                  |«       |j	                  d«       | j                  |t        j                  «       y)zŒ
        The L{Deferred} by default errbacks with a L{defer.TimeoutError}
        if it times out before callbacking or errbacking.
        r€  r�  N)r+   r    r=  r  r%  rû   r   r  ©r`   r  r#  s      r9   Útest_timedOutz%DeferredAddTimeoutTests.test_timedOut�  sP   € ô
 “ˆÜ$›JˆØ	�‰�R˜ÔØ×Ñ˜AÔà�‰�bÔà×Ñ˜Q¤× 2Ñ 2Õ3r;   c                óâ   — t        «       }t        «       }|j                  d|t        ¬«       | j	                  |«       |j                  d«       | j                  d| j                  |«      «       y)a1  
        If a custom C{onTimeoutCancel] function is provided, the
        L{Deferred} returns the custom function's return value if the
        L{Deferred} times out before callbacking or errbacking.
        The custom C{onTimeoutCancel} function can return a result instead of
        a failure.
        r€  rK  r�  r5  N©r+   r    r=  r8  r  r%  r[   r  r\  s      r9   Útest_timedOutCustomz+DeferredAddTimeoutTests.test_timedOutCustom«  sY   € ô “ˆÜ$›JˆØ	�‰�R˜´ˆÔ>Ø×Ñ˜AÔà�‰�bÔà×Ñ˜ t×';Ñ';¸AÓ'>Õ?r;   c                óÚ   — t        «       }t        d„ «      }|j                  d|«       | j                  |«       |j	                  d«       | j                  | j                  |«      d«       y)z×
        If a cancellation function is provided when the L{Deferred} is
        initialized, the L{Deferred} returns the cancellation value's
        non-failure return value when the L{Deferred} times out.
        c                ó$   — | j                  d«      S )NúI was cancelled!rN   r„  s    r9   rð   zLDeferredAddTimeoutTests.test_timedOutProvidedCancelSuccess.<locals>.<lambda>Ã  s   € ¨a¯j©jÐ9KÓ.L€ r;   r€  r�  rc  N)r+   r    r=  r  r%  r[   r  r\  s      r9   Ú"test_timedOutProvidedCancelSuccessz:DeferredAddTimeoutTests.test_timedOutProvidedCancelSuccess¼  sZ   € ô “ˆÜ#Ñ$LÓMˆØ	�‰�R˜ÔØ×Ñ˜AÔà�‰�bÔà×Ñ˜×-Ñ-¨aÓ0Ð2DÕEr;   c                ó  ‡— t        «       }t        d«      Št        ˆfd„«      }|j                  d|«       | j	                  |«       |j                  d«       | j                  |t        «      }| j                  |j                  ‰«       y)zÛ
        If a cancellation function is provided when the L{Deferred} is
        initialized, the L{Deferred} returns the cancellation value's
        non-L{CanceledError} failure when the L{Deferred} times out.
        úwhat!c                ó&   •— | j                  ‰«      S r3   )rª   )r  rn   s    €r9   rð   zLDeferredAddTimeoutTests.test_timedOutProvidedCancelFailure.<locals>.<lambda>Ó  s   ø€ ¨q¯y©y¸Ó/?€ r;   r€  r�  N)	r+   rR  r    r=  r  r%  rû   rm   r_   )r`   r  r#  r8   rn   s       @r9   Ú"test_timedOutProvidedCancelFailurez:DeferredAddTimeoutTests.test_timedOutProvidedCancelFailureË  sm   ø€ ô “ˆÜ˜7Ó#ˆÜ$Ó%?Ó@ˆØ	�‰�R˜ÔØ×Ñ˜AÔà�‰�bÔà× Ñ  ¤JÓ/ˆØ�‰�a—g‘g˜uÕ%r;   c                óˆ  ‡‡— t        «       }t        «       }|j                  d|«       t        «       ŠdŠdˆˆfd„}|j                  |«       |j	                  «        ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       |j                  d«       | j                  ‰«       y)a-  
        If the L{Deferred} is manually cancelled before the timeout, it
        is not re-cancelled (no L{AlreadyCancelled} error, and also no
        canceling of inner deferreds), and the default C{onTimeoutCancel}
        function is not called, preserving the original L{CancelledError}.
        r€  Nc                ó   •— | Š‰S r3   rG   ©r8   Ú	dCanceledrC  s    €€r9   rS  zCDeferredAddTimeoutTests.test_cancelBeforeTimeout.<locals>.onErrbackì  ó   ø€ àˆIØ Ð r;   r�  rU  )r+   r    r=  rY   rú   r4  r/   rm   rÙ   r   r   r%  r  ©r`   r  r#  rS  rl  rC  s       @@r9   Útest_cancelBeforeTimeoutz0DeferredAddTimeoutTests.test_cancelBeforeTimeoutÜ  s�   ù€ ô “ˆÜ$›JˆØ	�‰�R˜Ôô )1«
ˆØˆ	ö	!ð
 	
�‰�YÔØ	�‰Œ
ð Ð$Ð$Ð$Ø×Ñ˜i¬Ô1Ø�‰�i—n‘n¤e×&:Ñ&:Ô;ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                ó”  ‡‡— t        «       }t        «       }|j                  d|t        ¬«       t        «       ŠdŠdˆˆfd„}|j	                  |«       |j                  «        ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       |j                  d«       | j                  ‰«       y)a,  
        If the L{Deferred} is manually cancelled before the timeout, it
        is not re-cancelled (no L{AlreadyCancelled} error, and also no
        canceling of inner deferreds), and the custom C{onTimeoutCancel}
        function is not called, preserving the original L{CancelledError}.
        r€  rK  Nc                ó   •— | Š‰S r3   rG   rk  s    €€r9   rS  zIDeferredAddTimeoutTests.test_cancelBeforeTimeoutCustom.<locals>.onErrback  rm  r;   r�  rU  )r+   r    r=  r8  rY   rú   r4  r/   rm   rÙ   r   r   r%  r  rn  s       @@r9   Útest_cancelBeforeTimeoutCustomz6DeferredAddTimeoutTests.test_cancelBeforeTimeoutCustomÿ  s¡   ù€ ô “ˆÜ$›JˆØ	�‰�R˜´ˆÔ>ô )1«
ˆØˆ	ö	!ð
 	
�‰�YÔØ	�‰Œ
ð Ð$Ð$Ð$Ø×Ñ˜i¬Ô1Ø�‰�i—n‘n¤e×&:Ñ&:Ô;ð 	�‰�bÔØ×Ñ˜MÕ*r;   c                óæ   — t        «       }t        d„ «      }|j                  d|t        ¬«       | j	                  |«       |j                  d«       | j                  d| j                  |«      «       y)zu
        A custom translation function can handle a L{Deferred} with a
        custom cancellation function.
        c                ó6   — | j                  t        d«      «      S )Nrf  )rª   rR  r„  s    r9   rð   zVDeferredAddTimeoutTests.test_providedCancelCalledBeforeTimeoutCustom.<locals>.<lambda>(  s   € ¨q¯y©y¼ÀGÓ9LÓ/M€ r;   r€  rK  r�  r5  Nr_  r\  s      r9   Ú,test_providedCancelCalledBeforeTimeoutCustomzDDeferredAddTimeoutTests.test_providedCancelCalledBeforeTimeoutCustom"  s]   € ô
 “ˆÜ$Ñ%MÓNˆØ	�‰�R˜´ˆÔ>Ø×Ñ˜AÔà�‰�bÔà×Ñ˜ t×';Ñ';¸AÓ'>Õ?r;   c                ón  ‡— t        «       }t        «       }dŠdˆfd„}|j                  |«       |j                  d|«       |j	                  d«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       | j                  |t        j                  «       y)a  
        An errback added before a timeout is added errbacks with a
        L{defer.CancelledError} when the timeout fires.  If the
        errback returns the L{defer.CancelledError}, it is translated
        to a L{defer.TimeoutError} by the timeout implementation.
        Nc                ó   •— | Š| S r3   rG   ©r8   rR  s    €r9   rª   zGDeferredAddTimeoutTests.test_errbackAddedBeforeTimeout.<locals>.errback<  ó   ø€ àˆJØˆHr;   r€  r�  ©r8   r/   r=   r/   )r+   r    rY   r=  r%  r4  r/   r_   r   r   rû   r  ©r`   r  r#  rª   rR  s       @r9   Útest_errbackAddedBeforeTimeoutz6DeferredAddTimeoutTests.test_errbackAddedBeforeTimeout0  s“   ø€ ô “ˆÜ$›Jˆàˆ
õ	ð
 	
�‰�WÔØ	�‰�R˜Ôà�‰�bÔàÐ%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø×Ñ˜j×.Ñ.´×0DÑ0DÔEà×Ñ˜Q¤× 2Ñ 2Õ3r;   c                óP  ‡— t        «       }t        «       }dŠdˆfd„}|j                  |«       |j                  d|«       |j	                  d«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       | j                  |«       y)zñ
        An errback added before a timeout is added errbacks with a
        L{defer.CancelledError} when the timeout fires.  If the
        errback suppresses the L{defer.CancelledError}, the deferred
        successfully completes.
        Nc                óH   •— | Š| j                  t        j                  «       y r3   )rN  r   r   rx  s    €r9   rª   z]DeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutSuppressesCancellation.<locals>.errbackX  s   ø€ àˆJØ�F‰F”5×'Ñ'Õ(r;   r€  r�  rÞ  )r+   r    rY   r=  r%  r4  r/   r_   r   r   r  r{  s       @r9   Ú4test_errbackAddedBeforeTimeoutSuppressesCancellationzLDeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutSuppressesCancellationL  s‹   ø€ ô “ˆÜ$›Jˆàˆ
õ	)ð
 	
�‰�WÔØ	�‰�R˜Ôà�‰�bÔàÐ%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø×Ñ˜j×.Ñ.´×0DÑ0DÔEà×Ñ˜QÕr;   c                óz  ‡— t        «       }t        «       }dŠdˆfd„}|j                  |«       |j                  d|t        «       |j                  d«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       | j                  d| j                  |«      «       y)a  
        An errback added before a timeout is added with a custom
        timeout function errbacks with a L{defer.CancelledError} when
        the timeout fires.  The timeout function runs if the errback
        returns the L{defer.CancelledError}.
        Nc                ó   •— | Š| S r3   rG   rx  s    €r9   rª   zMDeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutCustom.<locals>.errbackt  ry  r;   r€  r�  r5  rz  ©r+   r    rY   r=  r8  r%  r4  r/   r_   r   r   r[   r  r{  s       @r9   Ú$test_errbackAddedBeforeTimeoutCustomz<DeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutCustomh  sš   ø€ ô “ˆÜ$›Jˆàˆ
õ	ð
 	
�‰�WÔØ	�‰�R˜¤Ô.à�‰�bÔàÐ%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø×Ñ˜j×.Ñ.´×0DÑ0DÔEà×Ñ˜ t×';Ñ';¸AÓ'>Õ?r;   c                óz  ‡— t        «       }t        «       }dŠdˆfd„}|j                  |«       |j                  d|t        «       |j                  d«       ‰€J ‚| j                  ‰t        «       | j                  ‰j                  t        j                  «       | j                  d| j                  |«      «       y)a  
        An errback added before a timeout is added with a custom
        timeout function errbacks with a L{defer.CancelledError} when
        the timeout fires.  The timeout function runs if the errback
        suppresses the L{defer.CancelledError}.
        Nc                ó
   •— | Šy r3   rG   rx  s    €r9   rª   zcDeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutSuppressesCancellationCustom.<locals>.errback�  s   ø€ à‰Jr;   r€  r�  r5  rÞ  r‚  r{  s       @r9   Ú:test_errbackAddedBeforeTimeoutSuppressesCancellationCustomzRDeferredAddTimeoutTests.test_errbackAddedBeforeTimeoutSuppressesCancellationCustom„  sš   ø€ ô “ˆÜ$›Jˆàˆ
õ	ð 	
�‰�WÔØ	�‰�R˜¤Ô.à�‰�bÔàÐ%Ð%Ð%Ø×Ñ˜j¬'Ô2Ø×Ñ˜j×.Ñ.´×0DÑ0DÔEà×Ñ˜ t×';Ñ';¸AÓ'>Õ?r;   c                ó  ‡‡— t        «       }dŠt        ˆfd„«      }dŠdˆfd„}|j                  |«       |j                  d|«       |j	                  d«       | j                  ‰‰«       | j                  ‰| j                  |«      «       y)a*  
        Given a deferred with a cancellation function that resumes the
        callback chain, a callback that is added to the deferred
        before a timeout is added to runs when the timeout fires.  The
        deferred completes successfully, without a
        L{defer.TimeoutError}.
        r  c                ó&   •— | j                  ‰«      S r3   rN   ©r#  r  s    €r9   rð   zSDeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeout.<locals>.<lambda>©  ó   ø€ ¨a¯j©j¸Ó.A€ r;   Nc                ó   •— | Š| S r3   rG   ©r_   rB  s    €r9   rO   zSDeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeout.<locals>.callback­  ó   ø€ àˆKØˆLr;   r€  r�  ©r_   r®   r=   r®   )r+   r    rœ   r=  r%  r[   rm   r  ©r`   r  r#  rO   rB  r  s       @@r9   Ú)test_callbackAddedToCancelerBeforeTimeoutzADeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeoutŸ  sw   ù€ ô “ˆØˆÜ#Ó$AÓBˆàˆõ	ð
 	
�‰�hÔØ	�‰�R˜Ôà�‰�bÔà×Ñ˜ gÔ.à�‰�g˜t×3Ñ3°AÓ6Õ7r;   c                ó&  ‡‡— t        «       }dŠt        ˆfd„«      }dŠd	ˆfd„}|j                  |«       |j                  d|t        ¬«       |j                  d«       | j                  ‰‰«       | j                  d| j                  |«      «       y)
ad  
        Given a deferred with a cancellation function that resumes the
        callback chain, a callback that is added to the deferred
        before a timeout is added to runs when the timeout fires.  The
        deferred completes successfully, without a
        L{defer.TimeoutError}.  The timeout's custom timeout function
        also runs.
        r  c                ó&   •— | j                  ‰«      S r3   rN   r‰  s    €r9   rð   zYDeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeoutCustom.<locals>.<lambda>Æ  rŠ  r;   Nc                ó   •— | Š| S r3   rG   rŒ  s    €r9   rO   zYDeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeoutCustom.<locals>.callbackÊ  r�  r;   r€  rK  r�  r5  rŽ  )r+   r    rœ   r=  r8  r%  r[   r  r�  s       @@r9   Ú/test_callbackAddedToCancelerBeforeTimeoutCustomzGDeferredAddTimeoutTests.test_callbackAddedToCancelerBeforeTimeoutCustom»  s}   ù€ ô “ˆØˆÜ#Ó$AÓBˆàˆõ	ð
 	
�‰�hÔØ	�‰�R˜´ˆÔ>à�‰�bÔà×Ñ˜ gÔ.à×Ñ˜ t×';Ñ';¸AÓ'>Õ?r;   Nr€   )rD   rE   rF   rf   r>  rI  rN  rW  rZ  r]  r`  rd  rh  ro  rr  ru  r|  r  rƒ  r†  r�  r”  rG   r;   r9   r:  r:    sm   „ ñó	:ó+óB +óD!+óF"+óH4ó@ó"Fó&ó"!+óF!+óF@ó4ó8 ó8@ó8@ó68ô8@r;   r:  c                  ó0   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zy)ÚEnsureDeferredTestsz&
    Tests for L{ensureDeferred}.
    c                óR   — t        «       }t        |«      }| j                  ||«       y)zK
        L{ensureDeferred} will pass through a Deferred unchanged.
        N)r    r)   rm   r@  s      r9   Útest_passesThroughDeferredsz/EnsureDeferredTests.test_passesThroughDeferredsÞ  s#   € ô &›ZˆÜ˜BÓˆØ�‰�b˜"Õr;   c                ó‚   — | j                  t        j                  «      5  t        d«       ddd«       y# 1 sw Y   yxY w)zr
        Passing L{ensureDeferred} a non-coroutine and a non-Deferred will
        raise a L{ValueError}.
        Ú	somethingN)r°  r   r±  r)   rŠ   s    r9   Ú'test_willNotAllowNonDeferredOrCoroutinez;EnsureDeferredTests.test_willNotAllowNonDeferredOrCoroutineæ  s5   € ð
 ×Ñœu×7Ñ7Ó8ñ 	(Ü˜;Ô'÷	(÷ 	(ñ 	(ús    5µ>c                ó  — dd„} |«       }| j                  |t        j                  «       t        |«      }t	        |t
        t           «       | j                  |t
        «       | j                  |«      }| j                  |d«       y)zM
        L{ensureDeferred} will turn a coroutine into a L{Deferred}.
        c               “  óP   K  — t        j                  d«      } | ƒ d {  –—† }|S 7 Œ­w©Nr=  rÊ  ©r#  rº  s     r9   rÐ  z=EnsureDeferredTests.test_ensureDeferredCoroutine.<locals>.runó  s%   è ø€ Ü—‘˜eÓ$ˆAØ—'ˆCØˆJð ús   ‚&�$ž&r=  N)r=   r®   )	r4  ÚtypesÚCoroutineTyper)   r   r    r®   r  r[   ©r`   rÐ  r<  r#  rº  s        r9   Útest_ensureDeferredCoroutinez0EnsureDeferredTests.test_ensureDeferredCoroutineî  ór   € ó
	ñ ‹EˆØ×Ñ˜a¤×!4Ñ!4Ô5ô ˜1ÓˆÜ�A”x¤‘}Ô%Ø×Ñ˜a¤Ô*ð ×"Ñ" 1Ó%ˆØ×Ñ˜˜eÕ$r;   c                ó  — dd„} |«       }| j                  |t        j                  «       t        |«      }t	        |t
        t           «       | j                  |t
        «       | j                  |«      }| j                  |d«       y)zX
        L{ensureDeferred} will turn a yield-from coroutine into a L{Deferred}.
        c               3  ól   K  — t        j                  d«      } t        t        | E d {  –—† «      }|S 7 Œ
­wrž  )r   r   r   r®   rŸ  s     r9   rÐ  z=EnsureDeferredTests.test_ensureDeferredGenerator.<locals>.run
  s,   è ø€ Ü—‘˜eÓ$ˆAÜ”s¨Ÿ\Ó+ˆCØˆJð *ús   ‚%4§2
¨4r=  N)r=   z#Generator[Deferred[str], None, str])	r4  r   ÚGeneratorTyper)   r   r    r®   r  r[   r¢  s        r9   Útest_ensureDeferredGeneratorz0EnsureDeferredTests.test_ensureDeferredGenerator  r¤  r;   Nr€   )rD   rE   rF   rf   r˜  r›  r£  r¨  rG   r;   r9   r–  r–  Ù  s   „ ñóó(ó%ô.%r;   r–  c                  ó   — e Zd ZdZdd„Zy)ÚTimeoutErrorTestsz1
    L{twisted.internet.defer} timeout code.
    c                óX  — t        «       }t        j                  |«       | j                  |t        j                  «       | j                  | j                  g«      }| j                  t        |«      d«       | j                  |d   d   t        «       | j                  |d   d   d«       y)zB
        L{twisted.internet.defer.timeout} is deprecated.
        rI   r   r>  r?  z~twisted.internet.defer.timeout was deprecated in Twisted 17.1.0; please use twisted.internet.defer.Deferred.addTimeout insteadN)r    r   r  r  r  r@  Útest_deprecatedTimeoutr[   r\   rm   rA  )r`   rQ   ÚwarningsShowns      r9   r¬  z(TimeoutErrorTests.test_deprecatedTimeout"  s•   € ô &.£ZˆÜ�‰�hÔØ×Ñ˜8¤U×%7Ñ%7Ô8Ø×*Ñ*¨D×,GÑ,GÐ+HÓIˆØ×Ñœ˜]Ó+¨QÔ/Ø�‰�m AÑ& zÑ2Ô4FÔGØ×ÑØ˜!Ñ˜YÑ'ðMõ	
r;   Nr€   )rD   rE   rF   rf   r¬  rG   r;   r9   rª  rª    s   „ ñô
r;   rª  c                óZ   — | j                  | j                  «       | j                  «        y)zú
    Tickle an asyncio event loop to call all of the things scheduled with
    call_soon, inasmuch as this can be done via the public API.

    @param loop: The asyncio event loop to flush the previously-called
        C{call_soon} entries from.
    N)Ú	call_soonÚstopÚrun_forever©Úloops    r9   ÚcallAllSoonCallsr´  3  s    € ð 	‡N�N�4—9‘9ÔØ×ÑÕr;   c                  óL   — e Zd Zd
d„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
y	)ÚDeferredFutureAdapterTestsc                óP   — t        «       }| j                  |j                  «       |S )zU
        Create a new event loop that will be closed at the end of the test.
        )Ú_new_event_loopr‡   ÚcloserÁ  s     r9   ÚnewLoopz"DeferredFutureAdapterTests.newLoop@  s!   € ô !Ó"ˆØ�‰˜Ÿ™Ô%Øˆr;   c                óT  — t        «       }| j                  «       }|j                  |«      }| j                  |j	                  «       d«       |j                  d«       t        |«       | j                  | j                  |«      d«       | j                  |j                  «       d«       y)zw
        L{Deferred.asFuture} returns a L{asyncio.Future} which fires when
        the given L{Deferred} does.
        Fró  N)	r    rº  ÚasFuturer[   r  rO   r´  r  ro   )r`   r#  r³  ÚaFutures       r9   Útest_asFuturez(DeferredFutureAdapterTests.test_asFutureH  s   € ô
 $›:ˆØ�|‰|‹~ˆØ—*‘*˜TÓ"ˆØ×Ñ˜Ÿ™›¨Ô/Ø	�
‰
�2ŒÜ˜ÔØ×Ñ˜×-Ñ-¨aÓ0°$Ô7Ø×Ñ˜Ÿ™Ó)¨2Õ.r;   c                óH  ‡— dŠdˆfd„}t        |«      }| j                  «       }|j                  |«      }|j                  «        t	        |«       | j                  ‰«       | j                  | j                  |«      d«       | j                  t        |j                  «       y)z‡
        L{Deferred.asFuture} returns a L{asyncio.Future} which, when
        cancelled, will cancel the original L{Deferred}.
        Fc                ó
   •— dŠy rÿ  rG   )Údprimerð  s    €r9   ÚcancelerzFDeferredFutureAdapterTests.test_asFutureCancelFuture.<locals>.canceler^  s   ø€ à‰Fr;   N©rÁ  r  r=   r|   )r    rº  r¼  rú   r´  r]   r[   r  r°  r   ro   )r`   rÂ  r#  r³  r½  rð  s        @r9   Útest_asFutureCancelFuturez4DeferredFutureAdapterTests.test_asFutureCancelFutureV  s�   ø€ ð ˆõ	ô % XÓ.ˆØ�|‰|‹~ˆØ—*‘*˜TÓ"ˆØ�‰ÔÜ˜ÔØ�‰˜ÔØ×Ñ˜×-Ñ-¨aÓ0°$Ô7Ø×Ñœ.¨'¯.©.Õ9r;   c                ó  — dd„}t        |«      }| j                  «       }|j                  |«      }|j                  «        t	        |«       | j                  | j                  |«      d«       | j                  t        |j                  «       y)zÒ
        While Futures don't support succeeding in response to cancellation,
        Deferreds do; if a Deferred is coerced into a success by a Future
        cancellation, that should just be ignored.
        c                ó&   — | j                  d«       y )Nrõ  rN   )rÁ  s    r9   rÂ  zGDeferredFutureAdapterTests.test_asFutureSuccessCancel.<locals>.cancelerr  s   € Ø�O‰O˜AÕr;   NrÃ  )
r    rº  r¼  rú   r´  r[   r  r°  r   ro   )r`   rÂ  r#  r³  r½  s        r9   Útest_asFutureSuccessCancelz5DeferredFutureAdapterTests.test_asFutureSuccessCancelk  sm   € ó	ô % XÓ.ˆØ�|‰|‹~ˆØ—*‘*˜TÓ"ˆØ�‰ÔÜ˜ÔØ×Ñ˜×-Ñ-¨aÓ0°$Ô7Ø×Ñœ.¨'¯.©.Õ9r;   c                ó  — t        «       }t        t        «       «      }| j                  «       }|j	                  |«      }t        |«       |j                  |«       t        |«       | j                  t        |j                  «       y)z€
        L{Deferred.asFuture} makes a L{asyncio.Future} fire with an
        exception when the given L{Deferred} does.
        N)	r    r/   r3  rº  r¼  r´  rª   r°  ro   )r`   r#  Ú
theFailurer³  Úfutures        r9   Útest_asFutureFailurez/DeferredFutureAdapterTests.test_asFutureFailure}  sc   € ô
 %›JˆÜÔ.Ó0Ó1ˆ
Ø�|‰|‹~ˆØ—‘˜DÓ!ˆÜ˜ÔØ	�	‰	�*ÔÜ˜ÔØ×ÑÔ+¨V¯]©]Õ;r;   c                ó  — | j                  «       }t        |¬«      }t        j                  |«      }| j	                  |«       |j                  d«       t        |«       | j                  | j                  |«      d«       y)zx
        L{Deferred.fromFuture} returns a L{Deferred} that fires
        when the given L{asyncio.Future} does.
        r²  rI  N)	rº  r   r    Ú
fromFuturer  Ú
set_resultr´  r[   r  )r`   r³  r½  r#  s       r9   Útest_fromFuturez*DeferredFutureAdapterTests.test_fromFuture‹  sh   € ð
 �|‰|‹~ˆÜ%¨4Ô0ˆÜ×Ñ Ó(ˆØ×Ñ˜AÔØ×Ñ˜1ÔÜ˜ÔØ×Ñ˜×-Ñ-¨aÓ0°!Õ4r;   c                ó$  — | j                  «       }t        |¬«      }t        j                  |«      }|j	                  «        t        |«       | j                  t        |j                  «       | j                  |«      j                  t        «       y)z¢
        L{Deferred.fromFuture} makes a L{Deferred} fire with
        an L{asyncio.CancelledError} when the given
        L{asyncio.Future} is cancelled.
        r²  N)rº  r   r    rÍ  rú   r´  r°  r   ro   rû   rN  ©r`   r³  Ú	cancelledr#  s       r9   Útest_fromFutureFutureCancelledz9DeferredFutureAdapterTests.test_fromFutureFutureCancelled˜  sl   € ð �|‰|‹~ˆÜ"(¨dÔ"3ˆ	Ü×Ñ 	Ó*ˆØ×ÑÔÜ˜ÔØ×Ñœ.¨)×*:Ñ*:Ô;Ø×Ñ˜QÓ×$Ñ$¤^Õ4r;   c                ód  — | j                  «       }t        |¬«      }t        j                  |«      }|j	                  «        t        |«       | j                  |j                  «       d«       | j                  t        |j                  «       | j                  |«      j                  t        «       y)zŽ
        L{Deferred.fromFuture} makes a L{Deferred} which, when
        cancelled, cancels the L{asyncio.Future} it was created from.
        r²  TN)rº  r   r    rÍ  rú   r´  r[   rÒ  r°  r   ro   rû   rN  rÑ  s       r9   Ú test_fromFutureDeferredCancelledz;DeferredFutureAdapterTests.test_fromFutureDeferredCancelled¦  s‚   € ð
 �|‰|‹~ˆÜ"(¨dÔ"3ˆ	Ü×Ñ 	Ó*ˆØ	�‰Œ
Ü˜ÔØ×Ñ˜×,Ñ,Ó.°Ô5Ø×Ñœ.¨)×*:Ñ*:Ô;Ø×Ñ˜QÓ×$Ñ$¤^Õ4r;   N)r=   r   r€   )rD   rE   rF   rº  r¾  rÄ  rÇ  rË  rÏ  rÓ  rÕ  rG   r;   r9   r¶  r¶  ?  s*   „ óó/ó:ó*:ó$<ó5ó5ô5r;   r¶  c                  óZ   — e Zd Zdd„Zdd„Zedd„«       Zedd„«       Zedd„«       Zdd„Z	y)	ÚCoroutineContextVarsTestsc                óÄ  ‡ ‡‡‡‡‡— t        «       Št        j                  d«      Š‰j                  d«       t	        «       Š‰j                  ˆfd„«       t	        «       Š‰j                  ˆfd„«       ‰j                  d„ «       t        j                  dˆˆfd„«       Št        ‰t        g t        d   f   «       t        j                  dˆˆˆˆ ˆˆfd„«       }t        |t        g t        d   f   «       ‰j                  d	«        |«       }‰j                  d«       ‰j                  d«       ‰j                  d«       ‰ j                  ‰ j                  |«      d
«       y)z§
        When an inlineCallbacks function is called, the context is taken from
        when it was first called. When it resumes, the same context is applied.
        ÚtestvarrI   c                ó&   •— ‰j                  d«      S rí  ©Úset©r1  Úvars    €r9   rð   zDCoroutineContextVarsTests.test_withInlineCallbacks.<locals>.<lambda>Â  ó   ø€ ¨s¯w©w°q«z€ r;   c                ó&   •— ‰j                  d«      S ©Né   rÛ  rÝ  s    €r9   rð   zDCoroutineContextVarsTests.test_withInlineCallbacks.<locals>.<lambda>Å  ó   ø€ ¸¿¹À»
€ r;   c                ó   — ddz  S r/  rG   r0  s    r9   rð   zDCoroutineContextVarsTests.test_withInlineCallbacks.<locals>.<lambda>Æ  ó
   € ¸¸A¹€ r;   c               3  ó†   •K  — t        «       } ‰j                  d| j                  d«       | –— ‰j                  d«       y ­w©NrI   Trî  ©r    r  rO   rÜ  ©r#  r  rÞ  s    €€r9   ÚyieldingDeferredzLCoroutineContextVarsTests.test_withInlineCallbacks.<locals>.yieldingDeferredÈ  s2   øè ø€ ä'›zˆAØ�O‰O˜A˜qŸz™z¨4Ô0ØŠGØ�G‰G�A�Jùs   ƒ>ANc               3  ór  •K  — ‰j                  ‰j                  «       d«       t        j                  d«      –— ‰j                  ‰j                  «       d«       ‰ j	                  d‰j
                  d«       ‰–— ‰j                  ‰j                  «       d«       ‰ j	                  d‰j
                  d«       	 ‰–— t        d«      ‚# t        $ r# ‰j                  ‰j                  «       d«       Y nw xY w ‰«       –— ‰j                  ‰j                  «       d«       t        j                  d«       y ­w)NrÀ   rI   Tú???? should have failed)r[   rø  r   r   r  rO   r¯  rÇ  )r  ÚmutatingDeferredÚmutatingDeferredThatFailsr`   rÞ  rê  s   €€€€€€r9   ÚtestFunctionzHCoroutineContextVarsTests.test_withInlineCallbacks.<locals>.testFunctionÒ  s  øè ø€ ð ×Ñ˜SŸW™W›Y¨Ô*ô —-‘- Ó"Ò"ð ×Ñ˜SŸW™W›Y¨Ô*ð �O‰O˜AÐ/×8Ñ8¸$Ô?Ø"Ò"ð ×Ñ˜SŸW™W›Y¨Ô*ð �O‰O˜AÐ8×AÑAÀ4ÔHð;Ø/Ò/ô  Ð 9Ó:Ð:øô ò /Ø× Ñ  §¡£¨AÖ.ð/úñ #Ó$Ò$Ø×Ñ˜SŸW™W›Y¨Ô*ä×Ñ˜dÕ#ùs+   ƒB6D7Â:C	 Â>D7Ã	)C5Ã2D7Ã4C5Ã5AD7rÀ   T©r=   z#Generator[Deferred[Any], Any, None])r+   ÚcontextvarsÚ
ContextVarrÜ  r    rœ   r   rž  r   r	   r%  r[   r  )r`   rï  r#  r  rí  rî  rÞ  rê  s   `  @@@@@r9   Útest_withInlineCallbacksz2CoroutineContextVarsTests.test_withInlineCallbacks¶  s)  ý€ ô
 “ˆä+6×+AÑ+AÀ)Ó+LˆØ�‰�Œ
ô ,4«:ÐØ×$Ñ$Ó%9Ô:ä3;³:Ð!Ø!×-Ñ-Ó.BÔCØ!×-Ñ-©oÔ>ä	×	Ñ	õ	ó 
ð	ô 	Ð$¤h¨r´8¸D±>Ð/AÑ&BÔCô 
×	Ñ	÷"	$ñ "	$ó 
ð"	$ôH 	�L¤(¨2¬x¸©~Ð+=Ñ">Ô?à�‰�Œ
Ù‹Nˆð 	�‰�aÔð 	�‰�aÔð 	�‰�aÔà×Ñ˜×-Ñ-¨aÓ0°$Õ7r;   c                óò   ‡ ‡‡— t        «       Št        j                  d«      Št        j                  dˆˆ ˆfd„«       }‰j                  d«        |«       }‰j                  d«       ‰ j                  |«       y)z”
        When an inlineCallbacks function resumes, we should be able to reset() a
        contextvar that was set when it was first called.
        rÙ  c               3  ó(  •K  — ‰j                  d«      } t        «       }‰j                  d|j                  d«       |–— ‰j	                  ‰j                  «       d«       ‰j                  | «       ‰j	                  ‰j                  «       d«       y ­w)Nrî  rI   TrÀ   )rÜ  r    r  rO   r[   rø  Úreset)Útokenr#  r  r`   rÞ  s     €€€r9   rê  zQCoroutineContextVarsTests.test_resetWithInlineCallbacks.<locals>.yieldingDeferred  sp   øè ø€ ð —G‘G˜A“JˆEô  (›zˆAØ�O‰O˜A˜qŸz™z¨4Ô0ØŠGØ×Ñ˜SŸW™W›Y¨Ô*à�I‰I�eÔà×Ñ˜SŸW™W›Y¨Õ*ùs   ƒBBrÀ   rI   Nrð  )r+   rñ  rò  r   rž  rÜ  r%  r  )r`   rê  r#  r  rÞ  s   `  @@r9   Útest_resetWithInlineCallbacksz7CoroutineContextVarsTests.test_resetWithInlineCallbacks  se   ú€ ô
 “ˆä+6×+AÑ+AÀ)Ó+Lˆä	×	Ñ	ö	+ó 
ð	+ð 	�‰�Œ
ÙÓˆð 	�‰�aÔØ×Ñ˜QÕr;   c              ƒ  óü  ‡K  — t        «       Šd}‰4 ƒd{  –—†  | j                  ‰j                  «       ‰j                  «       }|j	                  ˆfd„«       | j                  ‰j                  «       | j                  |j                  «       ddd«      ƒd{  –—†  | j                  |j                  «       |ƒ d{  –—†  | j                  ‰j                  «       y7 ŒÊ7 ŒG# 1 ƒd{  –—†7  sw Y   ŒWxY w7 Œ9­w)zQ
        L{DeferredLock} can be used as an asynchronous context manager.
        Nc                ó$   •— ‰j                  «       S r3   ©rÏ  )r1  rÑ  s    €r9   rð   z>CoroutineContextVarsTests.test_asyncWithLock.<locals>.<lambda>1  s   ø€  D§L¡L£N€ r;   )r#   r]   rÎ  rÍ  rœ   r  rð  )r`   r#  rÑ  s     @r9   Útest_asyncWithLockz,CoroutineContextVarsTests.test_asyncWithLock'  sÂ   øè ø€ ô
 ‹~ˆØˆØ÷ 	'ñ 	'Ø�O‰O˜DŸK™KÔ(Ø—‘“ˆAØ�M‰MÓ2Ô3Ø�O‰O˜DŸK™KÔ(Ø×Ñ˜QŸX™XÔ&÷	'÷ 	'ð 	�‰˜Ÿ™Ô!Ø�ˆØ×Ñ˜Ÿ™Õ%ð	'øð 	'ø÷ 	'÷ 	'ñ 	'úð 	úsQ   ƒC<–C!—C<šA6C%ÂC<ÂC#Â$C<Ã C:Ã!C<Ã#C<Ã%C7Ã+C.Ã,C7Ã3C<c              ƒ  óª  ‡K  — t        d«      Š‰4 ƒd{  –—†  | j                  ‰j                  d«       ‰4 ƒd{  –—†  | j                  ‰j                  d«       ‰j                  «       }‰j                  «       }| j                  ‰j                  d«       | j	                  |j
                  «       | j                  |j
                  «       ddd«      ƒd{  –—†  | j                  ‰j                  d«       | j	                  j
                  «       j                  ˆfd„«       |j                  ˆfd„«       |ƒ d{  –—†  |ƒ d{  –—†  | j                  ‰j                  d«       ddd«      ƒd{  –—†  | j                  ‰j                  d«       y7 �Œ†7 �Œb7 ŒÆ# 1 ƒd{  –—†7  sw Y   ŒÖxY w7 Œt7 Œl7 ŒB# 1 ƒd{  –—†7  sw Y   ŒRxY w­w)z^
        L{DeferredSemaphore} can be used as an asynchronous context
        manager.
        rî  NrÀ   rI   r   c                ó$   •— ‰j                  «       S r3   rû  ©r1  rê  s    €r9   rð   zCCoroutineContextVarsTests.test_asyncWithSemaphore.<locals>.<lambda>K  ó   ø€  S§[¡[£]€ r;   c                ó$   •— ‰j                  «       S r3   rû  rÿ  s    €r9   rð   zCCoroutineContextVarsTests.test_asyncWithSemaphore.<locals>.<lambda>L  r   r;   )r%   r[   ÚtokensrÍ  r]   rð  r  rœ   )r`   rã   ró   rê  s      @r9   Útest_asyncWithSemaphorez1CoroutineContextVarsTests.test_asyncWithSemaphore8  sn  øè ø€ ô   Ó"ˆà÷ 	,ñ 	,Ø×Ñ˜SŸZ™Z¨Ô+Ø÷ ,ñ ,Ø× Ñ  §¡¨QÔ/Ø—[‘[“]�Ø—[‘[“]�Ø× Ñ  §¡¨QÔ/Ø—‘ §	¡	Ô*Ø× Ñ  §¡Ô+÷,÷ ,ð ×Ñ˜SŸZ™Z¨Ô+Ø�O‰O˜BŸI™IÔ&Ø�N‰NÓ2Ô3Ø�N‰NÓ2Ô3Ø�HˆHØ�HˆHØ×Ñ˜SŸZ™Z¨Ô+÷	,÷ 	,ð  	×Ñ˜Ÿ™ QÕ'ð!	,ùð,ùð ,ø÷ ,÷ ,ñ ,úð øØøð	,ø÷ 	,÷ 	,ñ 	,üsª   ƒG•F–G™#F>¼F½F>Á BF#ÃF>ÃF!ÃA(F>ÅF8Å	F>ÅF:Å F>Å.GÅ9F<Å:"GÆF>Æ!F>Æ#F5	Æ)F,Æ*F5	Æ1F>Æ:F>Æ<GÆ>GÇGÇGÇGc              ƒ  ó@  K  — t        «       }| j                  t        d«      5  |4 ƒd{  –—†  | j                  |j                  «       t        d«      ‚7 Œ*# 1 ƒd{  –—†7  sw Y   nxY w	 ddd«       n# 1 sw Y   nxY w| j                  |j                  «       y­w)zw
        C{DeferredLock} correctly propagates exceptions when
        used as an asynchronous context manager.
        zsome specific exceptionN)r#   ÚassertRaisesRegexr¯  r]   rÎ  r  r!  s     r9   Útest_asyncWithLockExceptionz5CoroutineContextVarsTests.test_asyncWithLockExceptionR  s�   è ø€ ô ‹~ˆØ×#Ñ#¤IÐ/HÓIñ 	;Ø÷ ;ñ ;Ø—‘ §¡Ô,ÜÐ 9Ó:Ð:ð;ø÷ ;÷ ;ñ ;úð ;÷	;÷ 	;ñ 	;úð 	×Ñ˜Ÿ™Õ%ùsI   ‚!B£A6ªA«A6®'AÁA6ÁA)	ÁA ÁA)	Á%A6Á-	BÁ6A?Á;#Bc                ó  ‡ ‡‡‡‡‡— t        «       Št        j                  d«      Š‰j                  d«       t	        «       Š‰j                  ˆfd„«       t	        «       Š‰j                  ˆfd„«       ‰j                  d„ «       dˆˆfd„Šdˆˆˆˆˆ ˆfd„}‰j                  d«       t         |«       «      }‰j                  d«       ‰j                  d«       ‰j                  d«       ‰ j                  ‰ j                  |«      d	«       y
)z—
        When a coroutine is called, the context is taken from when it was first
        called. When it resumes, the same context is applied.
        rÙ  rI   c                ó&   •— ‰j                  d«      S rí  rÛ  rÝ  s    €r9   rð   zJCoroutineContextVarsTests.test_contextvarsWithAsyncAwait.<locals>.<lambda>k  rß  r;   c                ó&   •— ‰j                  d«      S rá  rÛ  rÝ  s    €r9   rð   zJCoroutineContextVarsTests.test_contextvarsWithAsyncAwait.<locals>.<lambda>n  rã  r;   c                ó   — ddz  S r/  rG   r0  s    r9   rð   zJCoroutineContextVarsTests.test_contextvarsWithAsyncAwait.<locals>.<lambda>o  rå  r;   c               “  ó–   •K  — t        «       } ‰j                  d| j                  d«       | ƒ d {  –—†  ‰j                  d«       y 7 Œ­wrç  rè  ré  s    €€r9   ÚasyncFuncAwaitingDeferredz[CoroutineContextVarsTests.test_contextvarsWithAsyncAwait.<locals>.asyncFuncAwaitingDeferredq  s9   øè ø€ Ü (£
ˆAØ�O‰O˜A˜qŸz™z¨4Ô0Ø�GˆGØ�G‰G�A�Jð ús   ƒ-A	°A±A	c               “  ó†  •K  — ‰j                  ‰j                  «       d«       t        j                  d«      ƒ d {  –—†  ‰j                  ‰j                  «       d«       ‰j	                  d‰j
                  d«       ‰ƒ d {  –—†  ‰j                  ‰j                  «       d«       ‰j	                  d‰j
                  d«       	 ‰ƒ d {  –—†  t        d«      ‚7 Œž7 ŒY7 Œ# t        $ r# ‰j                  ‰j                  «       d«       Y nw xY w ‰ «       ƒ d {  –—†7   ‰j                  ‰j                  «       d«       y­w)NrÀ   rI   r   Trì  rî  )r[   rø  r   r   r  rO   r¯  )r  r  rí  rî  r`   rÞ  s   €€€€€€r9   rï  zNCoroutineContextVarsTests.test_contextvarsWithAsyncAwait.<locals>.testFunctionx  s  øè ø€ à×Ñ˜SŸW™W›Y¨Ô*ô —-‘- Ó"×"Ð"ð ×Ñ˜SŸW™W›Y¨Ô*ð �O‰O˜AÐ/×8Ñ8¸$Ô?Ø"×"Ð"ð ×Ñ˜SŸW™W›Y¨Ô*ð �O‰O˜AÐ8×AÑAÀ4ÔHð;Ø/×/Ð/ô  Ð 9Ó:Ð:ð) #øð #øð 0ùÜò /Ø× Ñ  §¡£¨AÖ.ð/úñ ,Ó-×-Ñ-Ø×Ñ˜SŸW™W›Y¨Ô*àùse   ƒ9E¼C½AEÂCÂAEÃC! ÃCÃC! ÃEÃEÃC! Ã!)DÄ
EÄDÄEÄDÄ&ErÀ   TNr€   )r=   rÃ   )
r+   rñ  rò  rÜ  r    rœ   r)   r%  r[   r  )r`   rï  r#  r  r  rí  rî  rÞ  s   `  @@@@@r9   Útest_contextvarsWithAsyncAwaitz8CoroutineContextVarsTests.test_contextvarsWithAsyncAwait_  sÓ   ý€ ô
 “ˆä+6×+AÑ+AÀ)Ó+LˆØ�‰�Œ
ô ,4«:ÐØ×$Ñ$Ó%9Ô:ä4<³JÐ!Ø!×-Ñ-Ó.BÔCØ!×-Ñ-©oÔ>ö	÷!	ò !	ðH 	�‰�Œ
Ü™<›>Ó*ˆð 	�‰�aÔð 	�‰�aÔð 	�‰�aÔà×Ñ˜×-Ñ-¨aÓ0°$Õ7r;   Nr€   )
rD   rE   rF   ró  rø  r@   rü  r  r  r  rG   r;   r9   r×  r×  µ  sQ   „ óO8ób ð@ ò&ó ð&ð  ò(ó ð(ð2 ò
&ó ð
&ôI8r;   r×  c                  óŒ   — e Zd Zdd„Zdd„Zdd„Z ej                  ed«      dd„«       Z	 ej                  ed«      dd„«       Z
y)	ÚInlineCallbackTestsc                ó~  — t        «       }t        «       }	 |j                  «        dd„}t        j                  |«       | j                  |«      }t        j                  |j                  «       «      }| j                  t        |«      d«       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d|d   d   «       | j                  d	|d   d   «       y
# t        $ r |j	                  «        Y �Œw xY w)r’  c              3  ó   K  — | –— y ­wr3   rG   r”  s    r9   r•  z>InlineCallbackTests.test_inlineCallbacksTracebacks.<locals>.ic¸  s   è ø€ Ø‹Gùr–  rî  r—  rÀ   r   rK   r˜  r™  rš  Nr›  rœ  r¢  s         r9   r™  z2InlineCallbackTests.test_inlineCallbacksTracebacks¬  s  € ô
 Ó ˆÜ$›Jˆð	Ø×ÑÔó	ô 	×Ñ˜bÔ!Ø×)Ñ)¨!Ó,ˆ
Ü×!Ñ! *×"?Ñ"?Ó"AÓBˆà×Ñœ˜R› !Ô$Ø�‰�l B q¡E¨!¡HÔ-Ø×ÑÐ-¨r°!©u°Q©xÔ8Ø×Ñ˜ " Q¡%¨¡(Ô+à�‰�l B q¡E¨!¡HÔ-Ø×ÑÐ9¸2¸a¹5À¹8ÔDØ×ÑÐ-¨r°!©u°Q©xÕ8øô# ò 	Ø�I‰I�Kð	úr¥  c                óž   — d„ dd| j                   dt        g}|D ]1  }| j                  t        j                  t        j
                  |«       Œ3 y)r«  c                ó   — | S r3   rG   r}  s    r9   rð   zIInlineCallbackTests.test_fromCoroutineRequiresCoroutine.<locals>.<lambda>Ï  r­  r;   rI   TNr®  r²  s      r9   r¯  z7InlineCallbackTests.test_fromCoroutineRequiresCoroutineÈ  rµ  r;   c                óœ  ‡‡— g }g }t        |j                  «      Št        |j                  «      Št        j                  dˆˆfd„«       } |«       }| j	                  ‰«       | j	                  ‰«       | j	                  |«       | j                  |g «       | j                  |g «       |j                  «        | j                  |‰g«       | j                  |g «       | j	                  |«       |j                  «        | j                  |«      }| j                  |j                  t        j                  «       | j                  |‰g«       y)a„  
        Cancelling an L{defer.inlineCallbacks} correctly handles the function
        catching the L{defer.CancelledError}.

        The desired behavior is:
            1. If the function is waiting on an inner deferred, that inner
               deferred is cancelled, and a L{defer.CancelledError} is raised
               within the function.
            2. If the function catches that exception, execution continues, and
               the deferred returned by the function is not resolved.
            3. Cancelling the deferred again cancels any deferred the function
               is waiting on, and the exception is raised.
        c               3  ó>   •K  — 	 ‰ –— ‰–— y # t         $ r Y Œw xY w­wr3   r  )rã   ró   s   €€r9   ÚtestFunczHInlineCallbackTests.test_inlineCallbacksCancelCaptured.<locals>.testFuncò  s+   øè ø€ ðØ’ð ‹Høô ò Ùðüs   ƒ… ‰Ž	—™šN)r=   z)Generator[Deferred[object], object, None])
r    rZ   r   rž  r  r[   rú   rû   rÙ   r   )r`   Úcanceller1CallsÚcanceller2Callsr  ÚfuncDrO  rã   ró   s         @@r9   Ú"test_inlineCallbacksCancelCapturedz6InlineCallbackTests.test_inlineCallbacksCancelCapturedß  s  ù€ ð 35ˆØ24ˆÜ'¨×(>Ñ(>Ó?ˆÜ'¨×(>Ñ(>Ó?ˆä	×	Ñ	õ	ó 
ð	ñ “
ˆà×Ñ˜BÔØ×Ñ˜BÔØ×Ñ˜EÔ"Ø×Ñ˜¨"Ô-Ø×Ñ˜¨"Ô-ð
 	�‰Œà×Ñ˜¨2¨$Ô/Ø×Ñ˜¨"Ô-Ø×Ñ˜EÔ"ð
 	�‰ŒØ×&Ñ& uÓ-ˆØ×Ñ˜Ÿ™¤u×';Ñ';Ô<Ø×Ñ˜¨2¨$Õ/r;   r¶  c                óH  — t        «       }t        j                  |«      }t        j                  dd„«       } ||«      }| j                  || j                  |«      «       t        j                  |«      }~~| j                   |«       «       | j                   |«       «       y)a�  
        When using L{defer.inlineCallbacks}, after the function exits, it will
        not keep references to the function itself or the arguments.

        This ensures that the machinery gets deallocated immediately rather than
        waiting for a GC, on CPython.

        The GC on PyPy works differently (del doesn't immediately deallocate the
        object), so we skip the test.
        c              3  ó   K  — | –— | S ­wr3   rG   ©rÐ  s    r9   r  zIInlineCallbackTests.test_inlineCallbacksNoCircularReference.<locals>.func'  s   è ø€ àŠGØˆHùs   ‚	N©rÐ  r   r=   r   )rÜ  r¹  rº  r   rž  r[   r  r�   ©r`   ÚobjÚ
objWeakRefr  r  ÚfuncDWeakRefs         r9   Ú'test_inlineCallbacksNoCircularReferencez;InlineCallbackTests.test_inlineCallbacksNoCircularReference  s�   € ô ›ˆÜ—[‘[ Ó%ˆ
ä	×	Ñ	ò	ó 
ð	ñ
 �S“	ˆØ×Ñ˜˜d×2Ñ2°5Ó9Ô:ä—{‘{ 5Ó)ˆð Øð 	×Ñ™*›,Ô'Ø×Ñ™,›.Õ)r;   c                óH  — t        «       }t        j                  |«      }dd„}t        j                   ||«      «      }| j                  || j                  |«      «       t        j                  |«      }~~| j                   |«       «       | j                   |«       «       y)zÂ
        Tests that there is no circular dependency when using
        L{Deferred.fromCoroutine}, so that the machinery gets cleaned up
        immediately rather than waiting for a GC.
        c              “  ó   K  — | S ­wr3   rG   r  s    r9   r  zCInlineCallbackTests.test_coroutineNoCircularReference.<locals>.funcF  s   è ø€ ØˆHùs   ‚Nr  )rÜ  r¹  rº  r    r4   r[   r  r�   r   s         r9   Ú!test_coroutineNoCircularReferencez5InlineCallbackTests.test_coroutineNoCircularReference:  s‡   € ô ›ˆÜ—[‘[ Ó%ˆ
ó	ô ×&Ñ&¡t¨C£yÓ1ˆØ×Ñ˜˜d×2Ñ2°5Ó9Ô:ä—{‘{ 5Ó)ˆð Øð 	×Ñ™*›,Ô'Ø×Ñ™,›.Õ)r;   Nr€   )rD   rE   rF   r™  r¯  r  rÆ  rÇ  r-   r$  r'  rG   r;   r9   r  r  «  sX   „ ó9ó8Wó.50ðn €V‡]�]�5Ð9Ó:ò!*ó ;ð!*ðF €V‡]�]�5Ð9Ó:ò*ó ;ñ*r;   r  )r8   z0Callable[..., Coroutine[Deferred[Any], Any, _T]]r=   zCallable[..., Deferred[_T]])r5   r<   r6   r<   r=   r/   )rQ   rQ  r=   r|   )rÑ  r5  r=   z(tuple[list[int], list[Deferred[object]]])r6  r<   r7  Úfloatr=   r®   )r³  r   r=   r|   )brf   Ú
__future__r   rñ  r>   r‹  rB  r_  r   r0   rÆ  rL  r¹  Úasyncior   r   r   r   r¸  Útypingr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   Úhamcrestr   r   r   Ú
hypothesisr   Úhypothesis.strategiesr   r   Útwisted.internetr   r   Útwisted.internet.deferr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   Útwisted.internet.taskr+   Útwisted.pythonr,   Útwisted.python.compatr-   Útwisted.python.failurer/   Útwisted.trialr@   r¯  rB   rK   rR   rS   rV   rX   rh   ÚSynchronousTestCaser‚   r¸  rÓ  rÕ  rê  rý  rA  r}  r³  r½  r
  r8  r:  r–  rª  r´  r¶  r×  r  rG   r;   r9   ú<module>r7     s8  ðñõ #ã Û Û 	Û 	Û Û Û Û Û ÷ó ÷÷ ÷ ÷ ñ ÷$ 2Ñ 1Ý Ý *Ý ç +÷÷ ÷ ó õ (Ý Ý 'Ý *Ý "ðØ7ðà óô	�9ô 	óó)ñ �m¨9Ô5€÷4ñ 4ô,*M�×!Ñ!ô *MôZS+�H×0Ñ0Ð2Gô S+÷l4ñ óô&~7�×,Ñ,ô ~7ôB;$�h×2Ñ2ô ;$ô|L$˜×5Ñ5ô L$ô^GI˜X×9Ñ9ô GIôTc3ˆx×+Ñ+ô c3ôLE˜X×9Ñ9ô Eô"A'˜8×7Ñ7Ð9Nô A'ôHz= (×"3Ñ"3ô z=ózôS@˜h×:Ñ:ô S@ôlA%˜(×+Ñ+ô A%ôH
˜×)Ñ)Ð+@ô 
ó,	ôs5 ×!2Ñ!2ô s5ôls8 × 1Ñ 1ô s8ôlj*˜(×6Ñ6õ j*r;   