+
    Dfj                       R t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	H
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]
P                  4      t ! R R]
P                  4      t ! R R]
P                  4      t ! R R]
P                  4      tR# )zD
Tests for Deferred handling by L{twisted.trial.unittest.TestCase}.
)annotations)deferreactorthreads)Failure)unittestc                  (    ] tR t^tR tR tR tRtR# )DeferredSetUpOKc                	h    \         P                  ! R 4      pVP                  V P                  4       V# valuer   succeedaddCallback_cb_setUpCalledselfds   & </usr/lib/python3/dist-packages/twisted/trial/test/detests.pysetUpDeferredSetUpOK.setUp   '    MM'"	d**+    c                	    R V n         R# TN_setUpCalledr   ignoreds   &&r   r   DeferredSetUpOK._cb_setUpCalled   s
     r   c                	<    V P                  V P                  4       R # N)
assertTruer   r   s   &r   test_okDeferredSetUpOK.test_ok   s    ))*r   r   N)__name__
__module____qualname____firstlineno__r   r   r$   __static_attributes__ r   r   r	   r	      s    
!+r   r	   c                  &    ] tR t^tRtR tR tRtR# )DeferredSetUpFailFc                	V    \         P                  ! \        P                  ! R 4      4      # )zi fail)r   failr   FailTestr#   s   &r   r   DeferredSetUpFail.setUp   s    zz(++H566r   c                	>    R \         n        V P                  R4       R# )TzI should not get calledN)r-   
testCalledr/   r#   s   &r   r$   DeferredSetUpFail.test_ok!   s    '+$		+,r   r+   Nr&   r'   r(   r)   r3   r   r$   r*   r+   r   r   r-   r-      s    J7-r   r-   c                  ,    ] tR t^&tRtR tR tR tRtR# )DeferredSetUpCallbackFailFc                	h    \         P                  ! R 4      pVP                  V P                  4       V# r   r   r   s   & r   r   DeferredSetUpCallbackFail.setUp)   r   r   c                	(    V P                  R 4       R# )zdeliberate failureNr/   r   s   &&r   r   )DeferredSetUpCallbackFail._cb_setUpCalled.   s    		&'r   c                	    R \         n        R# r   )r7   r3   r#   s   &r   r$   !DeferredSetUpCallbackFail.test_ok1   s    /3!,r   r+   N)	r&   r'   r(   r)   r3   r   r   r$   r*   r+   r   r   r7   r7   &   s    J
(4r   r7   c                  &    ] tR t^5tRtR tR tRtR# )DeferredSetUpErrorFc                	@    \         P                  ! \        R 4      4      # )zdeliberate error)r   r/   RuntimeErrorr#   s   &r   r   DeferredSetUpError.setUp8   s    zz,'9:;;r   c                	    R \         n        R# r   )r@   r3   r#   s   &r   r$   DeferredSetUpError.test_ok;   s    (,%r   r+   Nr5   r+   r   r   r@   r@   5   s    J<-r   r@   c                  &    ] tR t^?tRtR tR tRtR# )DeferredSetUpNeverFireFc                	,    \         P                  ! 4       # r!   r   Deferredr#   s   &r   r   DeferredSetUpNeverFire.setUpB       ~~r   c                	    R \         n        R# r   )rG   r3   r#   s   &r   r$   DeferredSetUpNeverFire.test_okE   s    ,0)r   r+   Nr5   r+   r   r   rG   rG   ?   s    J 1r   rG   c                  ,    ] tR t^ItRtR tR tR tRtR# )DeferredSetUpSkipFc                	h    \         P                  ! R 4      pVP                  V P                  4       V# r   )r   r   r   _cb1r   s   & r   r   DeferredSetUpSkip.setUpL   s%    MM'"	dii r   c                	.    \         P                  ! R 4      h)zskip mer   SkipTestr   s   &&r   rR   DeferredSetUpSkip._cb1Q   s    	**r   c                	    R \         n        R# r   )rP   r3   r#   s   &r   r$   DeferredSetUpSkip.test_okT   s    '+$r   r+   N)	r&   r'   r(   r)   r3   r   rR   r$   r*   r+   r   r   rP   rP   I   s    J
+,r   rP   c                      ] tR t^XtRtR tR tR tR tR t	R t
]P                  R 4       tR	 tR
 tR tR tR tR tR]n        RtR# )DeferredTestsFc                	(    V P                  V4       R # r!   r;   r   reasons   &&r   _cb_failDeferredTests._cb_fail[   s    		&r   c                	    \        V4      hr!   )rB   r]   s   &&r   	_cb_errorDeferredTests._cb_error^   s    6""r   c                	.    \         P                  ! V4      hr!   rU   r]   s   &&r   _cb_skipDeferredTests._cb_skipa   s    ''r   c                	(    R V P                   n        R# r   	__class__touchedr   s   &&r   _touchClassDeferredTests._touchClassd   s    !%r   c                	(    R V P                   n        R# )FNrh   r#   s   &r   r   DeferredTests.setUpg   s    !&r   c                	.    \         P                  ! R 4      # )success)r   r   r#   s   &r   	test_passDeferredTests.test_passj   s    }}Y''r   c              #  8   "   V P                  R4       Rx  R# 5i)z<
Test case that is decorated with L{defer.inlineCallbacks}.
N)rk   r#   s   &r   test_passInlineCallbacks&DeferredTests.test_passInlineCallbacksm   s     
 	
s   c                	L    \         P                  ! V P                  R 4      4      # )zI fail)r   r/   failureExceptionr#   s   &r   	test_failDeferredTests.test_failu   s    zz$//9::r   c                	h    \         P                  ! R 4      pVP                  V P                  4       V# r;   )r   r   r   r_   r   s   & r   test_failureInCallback$DeferredTests.test_failureInCallbackx   s%    MM&!	dmm$r   c                	h    \         P                  ! R 4      pVP                  V P                  4       V# )errorr   r   r   rb   r   s   & r   test_errorInCallback"DeferredTests.test_errorInCallback}   s%    MM'"	dnn%r   c                	    \         P                  ! R 4      pVP                  V P                  4       VP                  V P                  4       V# )skip)r   r   r   re   rk   r   s   & r   	test_skipDeferredTests.test_skip   s7    MM&!	dmm$	d&&'r   c                	0    \         P                  ! R  4      # )c                     R # r!   r+   r+   r   r   <lambda>+DeferredTests.test_thread.<locals>.<lambda>   s    Tr   )r   deferToThreadr#   s   &r   test_threadDeferredTests.test_thread   s    $$\22r   c                	h    \         P                  ! R 4      pVP                  V P                  4       V# )todor   r   s   & r   test_expectedFailure"DeferredTests.test_expectedFailure   s%    MM&!	dnn%r   zExpected failurer+   N)r&   r'   r(   r)   rj   r_   rb   re   rk   r   rq   r   inlineCallbacksrt   rx   r{   r   r   r   r   r   r*   r+   r   r   r[   r[   X   sk    G#(&'(  ;

3
 !3r   r[   c                      ] tR t^t$ RtR]R&   R t^]n        R tR t	R]	n        R t
^ ]
n        R	 tR
 tR]n        R tR]n        R]n        R tR]n        R]n        R tR]n        R tR]n        RtR# )TimeoutTestsNzFailure | NonetimedOutc                	t    \         P                  ! 4       p\        P                  ! ^ VP                  R4       V#     zhoorj!r   rJ   r   	callLatercallbackr   s   & r   rq   TimeoutTests.test_pass   s)    NN!QZZ2r   c                	t    \         P                  ! 4       p\        P                  ! ^ VP                  R4       V# r   r   r   s   & r   test_passDefaultTimeoutTests.test_passDefault   s)    NN!QZZ2r   c                	,    \         P                  ! 4       # r!   rI   r#   s   &r   test_timeoutTimeoutTests.test_timeout   rL   r   g?c                	,    \         P                  ! 4       # r!   rI   r#   s   &r   test_timeoutZeroTimeoutTests.test_timeoutZero   rL   r   c                .    R pV P                  V4       R# )z
A cleanup can return a deferred.
The cleanup is successuful as long as the deferred is resolve sooner than the default
test case timeout (DEFAULT_TIMEOUT_DURATION seconds)
c                 t    \         P                  ! 4       p \        P                  ! ^ V P                  R4       V # )r   rp   r   )r   s    r   cleanup8TimeoutTests.test_addCleanupPassDefault.<locals>.cleanup   s)     AaY7Hr   N
addCleanupr   r   s   & r   test_addCleanupPassDefault'TimeoutTests.test_addCleanupPassDefault   s    	
 	 r   c                .    R pV P                  V4       R# )z
A cleanup can return a deferred.
When the deferred returned by addCleanup is not resolved sooner than the
test's timeout, the test is considered failed.
c                 ,    \         P                  ! 4       # r!   rI   r+   r   r   r   4TimeoutTests.test_addCleanupTimeout.<locals>.cleanup       >>##r   Nr   r   s   & r   test_addCleanupTimeout#TimeoutTests.test_addCleanupTimeout   s    	$ 	 r   c                	,    \         P                  ! 4       # r!   rI   r#   s   &r   r   !TimeoutTests.test_expectedFailure   rL   r   zi will get it right, eventuallyc                	,    \         P                  ! 4       # r!   rI   r#   s   &r   r   TimeoutTests.test_skip   rL   r   c                	`   a  V 3R  lp\         P                  ! 4       pVP                  V4       V# )c                *   < V SP                   n        V # r!   )ri   r   )errr   s   &r   r   4TimeoutTests.test_errorPropagation.<locals>.timedOut   s    &)DNN#Jr   )r   rJ   
addErrback)r   r   r   s   f  r   test_errorPropagation"TimeoutTests.test_errorPropagation   s'    	 NN	Xr   c                	z    \         P                  ! 4       pR  pVP                  V4       VP                  ^4       V# )c                ,    \         P                  ! 4       # r!   rI   )rs   &r   	neverFire;TimeoutTests.test_calledButNeverCallback.<locals>.neverFire   r   r   )r   rJ   r   r   )r   r   r   s   &  r   test_calledButNeverCallback(TimeoutTests.test_calledButNeverCallback   s1    NN	$ 	
i 	

1r   r+   )r&   r'   r(   r)   r   __annotations__rq   timeoutr   r   r   r   r   r   r   r   r   r   r   r*   r+   r   r   r   r      s    #Hn#
 I  L   !!
! &)"  $'  A  I6IN %(! +.''r   r   c                  &    ] tR t^tRtR tR tRtR# )TestClassTimeoutAttributeg?c                	:    \         P                  ! 4       V n        R # r!   )r   rJ   r   r#   s   &r   r   TestClassTimeoutAttribute.setUp   s    !r   c                	(    R V n         V P                  # )T)methodCalledr   r#   s   &r   
testMethod$TestClassTimeoutAttribute.testMethod   s     vvr   )r   r   N)r&   r'   r(   r)   r   r   r   r*   r+   r   r   r   r      s    G"r   r   N)__doc__
__future__r   twisted.internetr   r   r   twisted.python.failurer   twisted.trialr   TestCaser	   r-   r7   r@   rG   rP   r[   r   r   r+   r   r   <module>r      s    # 4 4 * "
+h'' 
+-)) -4 1 1 4-** -1X.. 1,)) ,83H%% 83vW.8$$ W.t 1 1 r   