+
    Df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    dll"$UG1--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     '1dii@@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#    
 '1dii1AC%K1O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_exceptionGreaterThan64k1TestAsynchronousFail.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_exceptionGreaterThan64kEncoded8TestAsynchronousFail.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{Gz?z/Deliberate failure to mask the hidden exceptionN)r   	callLaterr   iterater^   r5   s   &r   testHiddenExceptionDelayedCall.testHiddenException   s1     	!TWW%		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" 	8CU	
$  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     NN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.     	!66Q;II*+ 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9U9U 		%8(:K:K 	 	H88		(>@Q@Q 	1 1"	!=!=		!2!2	#h22 #*/8,, */Z,, " "#	x33 	 $	(## :&(++ & X&&  
)) 
, < < ,r   