+
    üÐjÁ  ã                   óN  € R t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	HtH
t
  ! R R]4      t ! R R]4      t ! R	 R
4      t ! R R]]P                  4      t ! R R]]P"                  4      t ! R R4      t ! R R]]P                  4      t ! R R]]P"                  4      t ! R R4      t ! R R]]P                  4      t ! R R]]P"                  4      t ! R R]P                  4      t ! R R]P"                  4      t ! R R ]P                  4      t]! R!R"4       ! R# R$]P                  4      4       t ! R% R&]P"                  4      t ! R' R(]P"                  4      t ! R) R*]P"                  4      t ! R+ R,]P"                  4      t R- t! ! R. R/]P                  4      t"R0# )1aJ  
Definitions of test cases with various interesting error-related behaviors, to
be used by test modules to exercise different features of trial's test runner.

See the L{twisted.trial.test.test_tests} module docstring for details about how
this code is arranged.

Some of these tests are also used by L{twisted.trial._dist.test}.
)ÚskipIf)ÚdeferÚprotocolÚreactor)Ú
deferLater)ÚunittestÚutilc                   ó   € ] tR t^tRtR# )ÚFoolishError© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú>/usr/lib/python3/dist-packages/twisted/trial/test/erroneous.pyr
   r
      ó   † Ûr   r
   c                   ó<   a € ] tR t^t o RtV 3R lR ltR tRtV tR# )Ú
LargeErrorz^
An exception which has a string representation of at least a specified
number of characters.
c                ó$   <€ V ^8„  d   QhRS[ RR/# )é   ÚminSizeÚreturnN©Úint)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚLargeError.__annotate__!   s   ø€ ÷ ñ ¡ð ¨ñ r   c                ó<   € \         P                  V 4       Wn        R # ©N)Ú	ExceptionÚ__init__r   )Úselfr   s   &&r   r$   ÚLargeError.__init__!   s   € Ü×Ñ˜4Ô ØŽr   c                ó4   € R V P                   ,          pRV R2# )ÚxzLargeError<I fail: Ú>©r   )r%   Úlarges   & r   Ú__str__ÚLargeError.__str__%   s   € Ø�d—l‘lÕ"ˆØ$ U G¨1Ð-Ð-r   r*   N)	r   r   r   r   Ú__doc__r$   r,   r   Ú__classdictcell__©r   s   @r   r   r      s   ø‡ € ñ÷
ð ÷.ð .r   r   c                   ó,   a € ] tR t^*t o R tR tRtV tR# )ÚFailureInSetUpMixinc                ó   € \        R 4      h)zI am a broken setUp method©r
   ©r%   s   &r   ÚsetUpÚFailureInSetUpMixin.setUp+   s   € ÜÐ7Ó8Ð8r   c                ó   € R # r"   r   r5   s   &r   Ú	test_noopÚFailureInSetUpMixin.test_noop.   ó   € Ùr   r   N)r   r   r   r   r6   r9   r   r/   r0   s   @r   r2   r2   *   s   ø‡ € ò9÷ð r   r2   c                   ó   € ] tR t^2tRtR# )ÚSynchronousTestFailureInSetUpr   Nr   r   r   r   r=   r=   2   r   r   r=   c                   ó   € ] tR t^6tRtR# )ÚAsynchronousTestFailureInSetUpr   Nr   r   r   r   r?   r?   6   r   r   r?   c                   ó,   a € ] tR t^:t o R tR tRtV tR# )ÚFailureInTearDownMixinc                ó   € \        R 4      h)zI am a broken tearDown methodr4   r5   s   &r   ÚtearDownÚFailureInTearDownMixin.tearDown;   s   € ÜÐ:Ó;Ð;r   c                ó   € R # r"   r   r5   s   &r   r9   Ú FailureInTearDownMixin.test_noop>   r;   r   r   N)r   r   r   r   rC   r9   r   r/   r0   s   @r   rA   rA   :   s   ø‡ € ò<÷ð r   rA   c                   ó   € ] tR t^BtRtR# )Ú SynchronousTestFailureInTearDownr   Nr   r   r   r   rH   rH   B   ó   † ó 	r   rH   c                   ó   € ] tR t^HtRtR# )Ú!AsynchronousTestFailureInTearDownr   Nr   r   r   r   rK   rK   H   r   r   rK   c                   ó4   a € ] tR t^Lt o RtRtR tR tRtV t	R# )ÚFailureButTearDownRunsMixinz/
A test fails, but its L{tearDown} still runs.
Fc                ó   € R V n         R# )TN©ÚtornDownr5   s   &r   rC   Ú$FailureButTearDownRunsMixin.tearDownS   s	   € ØˆŽr   c                ó   € \        R4      h)z
A test that fails.
zI am a broken testr4   r5   s   &r   Ú
test_failsÚ&FailureButTearDownRunsMixin.test_failsV   s   € ô Ð/Ó0Ð0r   rO   N)
r   r   r   r   r.   rP   rC   rS   r   r/   r0   s   @r   rM   rM   L   s    ø‡ € ñð €Hò÷1ð 1r   rM   c                   ó   € ] tR t^]tRtR# )Ú%SynchronousTestFailureButTearDownRunsr   Nr   r   r   r   rV   rV   ]   rI   r   rV   c                   ó   € ] tR t^ctRtR# )Ú&AsynchronousTestFailureButTearDownRunsr   Nr   r   r   r   rX   rX   c   rI   r   rX   c                   ó2   a € ] tR t^it o R tR tR tRtV tR# )ÚTestRegularFailc                ó(   € V P                  R 4       R# )úI failN©Úfailr5   s   &r   Ú	test_failÚTestRegularFail.test_failj   s   € Ø�	‰	�(Ör   c                ó&   € V P                  4        R # r"   )Ú
subroutiner5   s   &r   Útest_subfailÚTestRegularFail.test_subfailm   s   € Ø�‰Ör   c                ó(   € V P                  R 4       R# )zI fail insideNr]   r5   s   &r   rb   ÚTestRegularFail.subroutinep   s   € Ø�	‰	�/Ö"r   r   N)	r   r   r   r   r_   rc   rb   r   r/   r0   s   @r   rZ   rZ   i   s   ø‡ € òò÷#ð #r   rZ   c                   ó‚   a € ] tR t^tt o RtRtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
RtV tR# )ÚTestAsynchronousFailz7
Test failures for L{unittest.TestCase} based classes.
r\   c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# ©r   r   N©r   ÚDeferred)r   r   s   "€r   r   Ú!TestAsynchronousFail.__annotate__{   s    ø€ ÷ Añ A™5Ÿ>™>¨$Õ/ñ Ar   c                ó:   € \        \        ^ V P                  R4      # )zG
A test which fails in the callback of the returned L{defer.Deferred}.
zI fail later©r   r   r^   r5   s   &r   r_   ÚTestAsynchronousFail.test_fail{   s   € ô œ' 1 d§i¡i°Ó@Ð@r   c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# rj   rk   )r   r   s   "€r   r   rm   �   s    ø€ ÷ Qñ Q©¯©¸Õ)=ñ Qr   c                óV   € \        \        ^ V P                  RRR,          ,           4      # )z_
A test which fails in the callback of the returned L{defer.Deferred}
with a very long string.
zI fail later: r(   é   ro   r5   s   &r   Útest_failGreaterThan64kÚ,TestAsynchronousFail.test_failGreaterThan64k�   s#   € ô
 œ' 1 d§i¡iÐ1AÀCÈ%ÅKÕ1OÓPÐPr   c                ó   <€ V ^8„  d   QhRR/# rj   r   )r   r   s   "€r   r   rm   ˆ   s   ø€ ÷ #ñ # ñ #r   c                ó,   € \        V P                  4      h)z1
A test which raises an exception synchronously.
)r#   Útextr5   s   &r   Útest_exceptionÚ#TestAsynchronousFail.test_exceptionˆ   s   € ô ˜Ÿ	™	Ó"Ð"r   c                ó   <€ V ^8„  d   QhRR/# rj   r   )r   r   s   "€r   r   rm   Ž   s   ø€ ÷  ñ  ¨dñ  r   c                ó   € \        R4      h)zS
A test which raises an exception with a long string representation
synchronously.
rs   )r   r5   s   &r   Útest_exceptionGreaterThan64kÚ1TestAsynchronousFail.test_exceptionGreaterThan64kŽ   s   € ô
 ˜ÓÐr   c                ó   <€ V ^8„  d   QhRR/# rj   r   )r   r   s   "€r   r   rm   •   s   ø€ ÷ 	/ñ 	/°Tñ 	/r   c                ó&   € \        RR,          4      h)zo
A test which synchronously raises an exception with a long string
representation including non-ascii content.
u   â˜ƒi €  )r#   r5   s   &r   Ú#test_exceptionGreaterThan64kEncodedÚ8TestAsynchronousFail.test_exceptionGreaterThan64kEncoded•   s   € ô ˜¨Õ-Ó.Ð.r   r   N)r   r   r   r   r.   rx   r_   rt   ry   r}   r�   r   r/   r0   s   @r   rh   rh   t   sG   ø‡ € ñð €D÷Að A÷Qð Q÷#ð #÷ ð  ÷	/ö 	/r   rh   c                   ó.   a € ] tR t^¡t o RtRtR tRtV tR# )Ú	ErrorTestz�
A test case which has a L{test_foo} which will raise an error.

@ivar ran: boolean indicating whether L{test_foo} has been run.
Fc                ó&   € RV n         ^^ ,           R# )z:
Set C{self.ran} to True and raise a C{ZeroDivisionError}
TN©Úranr5   s   &r   Útest_fooÚErrorTest.test_fooª   s   € ð ˆŒØ	ˆA�ˆr   r†   N)	r   r   r   r   r.   r‡   rˆ   r   r/   r0   s   @r   r„   r„   ¡   s   ø‡ € ñð €C÷ð r   r„   Tzskipping this testc                   ó   € ] tR t^²tRtR# )ÚTestSkipTestCaser   Nr   r   r   r   r‹   r‹   ²   s   † ãr   r‹   c                   ód   a € ] tR t^·t o RtR tR t]P                  ! R]	R7      .]n        Rt
V tR# )ÚDelayedCallzsomething blew upc                ó,   € \        V P                  4      hr"   )ÚRuntimeErrorÚhiddenExceptionMsgr5   s   &r   ÚgoÚDelayedCall.goº   s   € Ü˜4×2Ñ2Ó3Ð3r   c                ó–   € \         P                  ! ^ V P                  4       \         P                  ! R4       V P	                  R4       R# )an  
What happens if an error is raised in a DelayedCall and an error is
also raised in the test?

L{test_reporter.ErrorReportingTests.testHiddenException} checks that
both errors get reported.

Note that this behaviour is deprecated. A B{real} test would return a
Deferred that got triggered by the callLater. This would guarantee the
delayed call error gets reported.
g{®Gáz„?z/Deliberate failure to mask the hidden exceptionN)r   Ú	callLaterr‘   Úiterater^   r5   s   &r   ÚtestHiddenExceptionÚDelayedCall.testHiddenException½   s1   € ô 	×Ò˜!˜TŸW™WÔ%Ü�Š˜ÔØ�	‰	ÐCÖDr   z!reactor\.iterate cannot be used.*)ÚmessageÚcategoryr   N)r   r   r   r   r�   r‘   r–   r   ÚsuppressÚDeprecationWarningr   r/   r0   s   @r   r�   r�   ·   s8   ø‡ € Ø,Ðò4òEð" 	�ŠØ8ÐCUô	
ð$Ð× Ò r   r�   c                   ó&   a € ] tR t^Ôt o R tRtV tR# )ÚReactorCleanupTestsc                ó:   € R  p\         P                  ! RV4       R# )c                  ó   € \        R 4       R# )zfoo!N)Úprintr   r   r   Ú_Ú8ReactorCleanupTests.test_leftoverPendingCalls.<locals>._Ö   s	   € Ü�&ŽMr   g     ˆÃ@N)r   r”   )r%   r¡   s   & r   Útest_leftoverPendingCallsÚ-ReactorCleanupTests.test_leftoverPendingCallsÕ   s   € ò	ô 	×Ò˜' 1Ö%r   r   N)r   r   r   r   r£   r   r/   r0   s   @r   r�   r�   Ô   s   ø‡ € ÷&ð &r   r�   c                   ó&   a € ] tR t^Üt o R tRtV tR# )ÚSocketOpenTestc                óˆ   € \         P                  ! 4       p\         P                  Vn         \        P                  ! ^ V4       R# )é    N)r   ÚFactoryÚProtocolr   Ú	listenTCP)r%   Úfs   & r   Útest_socketsLeftOpenÚ#SocketOpenTest.test_socketsLeftOpenÝ   s-   € Ü×ÒÓˆÜ×&Ñ&ˆŒ
Ü×Ò˜!˜QÖr   r   N)r   r   r   r   r­   r   r/   r0   s   @r   r¦   r¦   Ü   s   ø‡ € ÷ ð  r   r¦   c                   ó2   a € ] tR t^ãt o R tR tR tRtV tR# )ÚTimingOutDeferredc                ó   € R # r"   r   r5   s   &r   Ú
test_alphaÚTimingOutDeferred.test_alphaä   r;   r   c                ó>   € R V n         \        P                  ! 4       pV# )T)ÚmethodCalledr   rl   )r%   Úds   & r   Útest_deferredThatNeverFiresÚ-TimingOutDeferred.test_deferredThatNeverFiresç   s   € Ø ˆÔÜ�NŠNÓˆØˆr   c                ó   € R # r"   r   r5   s   &r   Ú
test_omegaÚTimingOutDeferred.test_omegaì   r;   r   )rµ   N)	r   r   r   r   r²   r·   rº   r   r/   r0   s   @r   r°   r°   ã   s   ø‡ € òò÷
ð r   r°   c                ó   € R# )zWi will raise an unexpected exception...
... *CAUSE THAT'S THE KINDA GUY I AM*

>>> 1/0
Nr   r5   s   &r   ÚunexpectedExceptionr½   ð   s   ‚ r   c                   ó:   a € ] tR t^øt o Rt^ tR tV 3R ltRtV t	R# )ÚEventuallyFailingTestCasez6
A test suite that fails after it is run a few times.
c                ó€   € V ;P                   ^,          un         V P                   ^8¼  d   V P                  R4       R# R# )z;
Run successfully a few times and then fail forever after.
zeventually failingN)Únr^   r5   s   &r   Útest_itÚ!EventuallyFailingTestCase.test_itÿ   s.   € ð 	�Š�!��Ø�6‰6�QŒ;Ø�I‰IÐ*Ö+ñ r   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r   rÁ   r   )r   r   s   "€r   r   Ú&EventuallyFailingTestCase.__annotate__ø   s   ø‡ ‚ ñ
 �Jò r   r   N)
r   r   r   r   r.   rÁ   rÂ   Ú__annotate_func__r   r/   r0   s   @r   r¿   r¿   ø   s   ø‡ € ñð €Aò,÷ ƒ r   r¿   N)#r.   r   r   Útwisted.internetr   r   r   Útwisted.internet.taskr   Útwisted.trialr   r#   r
   r   r2   ÚSynchronousTestCaser=   ÚTestCaser?   rA   rH   rK   rM   rV   rX   rZ   rh   r„   r‹   r�   r�   r¦   r°   r½   r¿   r   r   r   Ú<module>rÌ      sŽ  ðñ
õ ç 5Ñ 5Ý ,ß (ô	�9ô 	ô.�ô .÷ñ ô	Ð$7¸×9UÑ9Uô 	ô	Ð%8¸(×:KÑ:Kô 	÷ñ ô	Ø˜H×8Ñ8ô	ô	Ð(>À×@QÑ@Qô 	÷1ñ 1ô"	Ø ×!=Ñ!=ô	ô	Ø ×!2Ñ!2ô	ô#�h×2Ñ2ô #ô*/˜8×,Ñ,ô */ôZ�×,Ñ,ô ñ" ˆÐ"Ó#ô	�x×3Ñ3ó 	ó $ð	ô�(×#Ñ#ô ô:&˜(×+Ñ+ô &ô �X×&Ñ&ô  ô
˜×)Ñ)ô 
òô, × <Ñ <ö ,r   