K i:mVddlZddlmZddlmZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlZddlmZddlmZddlmZmZmZdd lmZdd lmZmZmZm Z m!Z!dd l"m#Z#m$Z$dd l%m&Z&ddl'Z'e'jPrdd l'm)Z)GddeZ*GddejVZ,GddeZ-GddeZ.GddejVZ/GddejVZ0GddeZ1GddejVZ2e3dk(rejhyy)N)ThreadPoolExecutor)futures) Generator)mock) native_str)gen)IOLoop TimeoutErrorPeriodicCallback)app_log) AsyncTestCasebind_unused_port ExpectLoggen_testsetup_with_context_manager)ignore_deprecation skipIfNonUnix)Future)ListceZdZdZdZdZdZdZdZdZ dZ d Z e d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZe dZe edZdZ y) TestIOLoopcd|_|j}||jfd}tj|||_|jd|jd|j t jd|j|j|j|jdy)NrcHxjdz c_|g|i|yNcalls)selfcallbackargskwargsold_add_callbacktests ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/tornado/test/ioloop_test.py add_callbackzBTestIOLoop.test_add_callback_return_sequence..add_callback1s" JJ!OJ X 7 7 7ciSNr)r&r$z>TestIOLoop.test_add_callback_return_sequence..6"r&cgSr(r)r)r&r$r*z>TestIOLoop.test_add_callback_return_sequence..7r+r&2) milliseconds ) rio_loopr%types MethodType add_timeoutdatetime timedeltastopstart assertLess)rloopr%r"r#s @@r$!test_add_callback_return_sequencez,TestIOLoop.test_add_callback_return_sequence)s ||,, 8",,\4@ *% *% ++.callback?sDK IIKr&c|d_jjtj_yNF)r>r0r%time start_time)rrsr$schedule_callbackz>TestIOLoop.test_add_callback_wakeup..schedule_callbackCs)DK LL % %h /"iikDOr&)places)r0r3rBwaitassertAlmostEqualrC assertTruer>)rrDrs` @r$test_add_callback_wakeupz#TestIOLoop.test_add_callback_wakeup<si  *   !2!2!46GH  tyy{DOOAF  $r&c,fd}tj|}jj|jj t j jz }j|d|jy)Nctjdtj_jj j y)N{Gz?)rBsleep stop_timer0r%r6r?sr$targetz@TestIOLoop.test_add_callback_wakeup_other_thread..targetOs2 JJt !YY[DN LL % %dii 0r&rP皙?) threadingThreadr0r%r7rGrBrOr8join)rrPthreaddeltas` r$%test_add_callback_wakeup_other_threadz0TestIOLoop.test_add_callback_wakeup_other_threadNsd 1 !!0 !!&,,/  dnn, s# r&c|jjtjd|j|j y)Nr) microseconds)r0r3r4r5r6rGr?s r$test_add_timeout_timedeltaz%TestIOLoop.test_add_timeout_timedelta\s.   !3!3!CTYYO r&ct\}} |jj|jdtj |j t|jj|jdtj |jj|j|jy#|jj|j|jwxYw)Ncyr(r)fdeventss r$r*z.TestIOLoop.test_multiple_add..dr&cyr(r)r^s r$r*z.TestIOLoop.test_multiple_add..lrar&) rr0 add_handlerfilenor READ assertRaises Exceptionremove_handlerclosersockports r$test_multiple_addzTestIOLoop.test_multiple_add`s%' d  LL $ $ 6      (( '   LL ' ' 6 JJL LL ' ' 6 JJLs BC ;Dct\}} |jj|j|j y#|j wxYwr()rr0rhrdrirjs r$test_remove_without_addz"TestIOLoop.test_remove_without_addss@&' d  LL ' ' 6 JJLDJJLs )A Act5|jj|jddd|j y#1swYxYwr()rr0add_callback_from_signalr6rGr?s r$test_add_callback_from_signalz(TestIOLoop.test_add_callback_from_signal|s> ! = LL 1 1$)) < =  = =s &A  Ac0td}tj|j}|jt 5|j |j ddd|j|jy#1swY*xYw)NF make_currentrQ) r rSrTr7rrqr6rUri)r other_iolooprVs r$*test_add_callback_from_signal_other_threadz5TestIOLoop.test_add_callback_from_signal_other_threadsu51 !!););<   ! E  1 1,2C2C D E  E Es B  Bctjfd}tdtj|}|j j t dD]}jdy)Ncjjjjj dy)NTall_fds)r%r6r7setri)closingrvsr$rPz:TestIOLoop.test_add_callback_while_closing..targets=  % %l&7&7 8    KKM   t  ,r&FrtrQcyr(r)r)r&r$r*z.rar&)rSEventr rTr7rGranger%)rrPrVir}rvs @@r$test_add_callback_while_closingz*TestIOLoop.test_add_callback_while_closingse//# - 51 !!0  t 4A  % %l 3 4r&cXtj\}} fd}jj|j |t j jjjjdztj|jdjjj|j |j|jy#|j|jwxYw)Ncfj|tjjyr() assertEqualr rer6)r_r`rs r$handlerz5TestIOLoop.test_read_while_writeable..handlers   5 r&rMsasdf)socket socketpairr0rcrdr rer3rB functoolspartialsendrGrhri)rclientserverrs` r$test_read_while_writeablez$TestIOLoop.test_read_while_writeables  **,   LL $ $V]]_gv{{ K LL $ $ !!#d*I,=,=fkk7,S  IIK LL ' '  8 LLN LLN LLN LLNs C D"D)c|jj|jj|j}|j |jj |yr()r0r3rBr6rGremove_timeoutrhandles r$test_remove_timeout_after_firez)TestIOLoop.test_remove_timeout_after_firesD))$,,*;*;*=tyyI  ##F+r&c(tdD]U}jjjjdzd}jj |Wjj fdj y)Niicyr(r)r)r&r$r*z8TestIOLoop.test_remove_timeout_cleanup..rar&cNjjjSr(r0r%r6r?sr$r*z8TestIOLoop.test_remove_timeout_cleanup..s$,,*C*CDII*Nr&)rr0r3rBrr%rG)rrtimeouts` r$test_remove_timeout_cleanupz&TestIOLoop.test_remove_timeout_cleanupsp t 1All..t||/@/@/BT/I<XG LL ' ' 0 1 !!"NO r&cddgjj}fd}jj|dz|fd}jj|dz|jj|dzjtjdj j ddgy)NFcFdd<jjyNTr)r0r)rr t2_handlesr$t1z7TestIOLoop.test_remove_timeout_from_timeout..t1sE!H LL ' ' 2r&rMcdd<y)NTrr)rsr$t2z7TestIOLoop.test_remove_timeout_from_timeout..t2s E!Hr&g{Gz?gQ?T)r0rBr3r6rNrGr)rnowrrrrs` @@r$ test_remove_timeout_from_timeoutz+TestIOLoop.test_remove_timeout_from_timeouts ll! 3   tR0 LL,,S4Z<    tTYY7 4  u .r&cng}|jj|jj|jd|jjt j d|jd|jj |jj|jd|jjd|jd|jjd|j|j|jt|gdy)Nrr)secondsrE)rrErr) r0r3rBappendr4r5call_at call_laterr6rGrsorted)rresultss r$test_timeout_with_argumentsz&TestIOLoop.test_timeout_with_argumentss   !2!2!4gnnaH   !3!3A!>PQR T\\..0'..!D 7>>15 499-  ,7r&c|jj|jjd}|j||jj |y)Ncyr(r)r)r&r$r*z4TestIOLoop.test_add_timeout_return..rar&)r0r3rBassertIsNotNonerrs r$test_add_timeout_returnz"TestIOLoop.test_add_timeout_returnsG))$,,*;*;*=|L V$ ##F+r&c|jj|jjd}|j||jj |y)Ncyr(r)r)r&r$r*z0TestIOLoop.test_call_at_return..rar&)r0rrBrrrs r$test_call_at_returnzTestIOLoop.test_call_at_returnsE%%dll&7&7&9<H V$ ##F+r&c|jjdd}|j||jj|y)Nrcyr(r)r)r&r$r*z3TestIOLoop.test_call_later_return..rar&)r0rrrrs r$test_call_later_returnz!TestIOLoop.test_call_later_returns8((L9 V$ ##F+r&cGdd}t\}}||tdjfdjd|j j y) zWhen a file object is used instead of a numeric file descriptor, the object should be closed (by IOLoop.close(all_fds=True), not just the fd. ceZdZdZdZdZy)8TestIOLoop.test_close_file_object..SocketWrapperc ||_d|_yrA)sockobjclosed)rrs r$__init__zATestIOLoop.test_close_file_object..SocketWrapper.__init__ s& # r&c6|jjSr()rrdr?s r$rdz?TestIOLoop.test_close_file_object..SocketWrapper.filenos||**,,r&cFd|_|jjyr=)rrrir?s r$riz>TestIOLoop.test_close_file_object..SocketWrapper.closes"  ""$r&N)__name__ __module__ __qualname__rrdrir)r&r$ SocketWrapperr s $ - %r&rFrtcHjdtjS)Ncyr(r)r^s r$r*zETestIOLoop.test_close_file_object....rar&)rcr re)r0socket_wrappersr$r*z3TestIOLoop.test_close_file_object..sG'' 7r&TrzN)rr run_syncrirIr)rrrrlr0rs @@r$test_close_file_objectz!TestIOLoop.test_close_file_objectsd % %)* &w/e,   d # --.r&ct\}gfd}jj|tjt j tj5}|jd|fjdddjjjjj|tjt j tj5}|jd|fjdddjdjdjjjjjy#1swY#xYw#1swYxYw)z>The handler callback receives the same fd object it passed in.cj|j\}}|jjyr()racceptrir6)r_r`connaddrfdsr server_socks r$handle_connectionzGTestIOLoop.test_handler_callback_file_object..handle_connection%s2 JJrN$++-JD$ JJL IIKr&z 127.0.0.1Nrr)rr0rcr re contextlibr}rconnectrGrhrdassertIsrri)rrlr client_sockrrs` @@r$!test_handler_callback_file_objectz,TestIOLoop.test_handler_callback_file_object sU,. T    .?M     0 K   d 3 4 IIK  ##K0   !3!3!57H&++V     0 K   d 3 4 IIK  c!fk* Q!3!3!56 ##K$6$6$89     s,$F1$F>1F;>Gct\}}d}|jj||tj|j t 5|jj|j|tjddd|jj|j|jy#1swYCxYw)Ncyr(r)r^s r$fz+TestIOLoop.test_mixed_fd_fileobj..f<s r&) rr0rcr rerfrgrdrhri)rrrlrs r$test_mixed_fd_fileobjz TestIOLoop.test_mixed_fd_fileobj9s,. T    a=   y ) K LL $ $[%7%7%91fkk J K ##K$6$6$89  K Ks :C  Ccdgdgfd}jj|jjdj dy)z:Calling start() twice should raise an error, not deadlock.Fc jjdd<jy#t$rdd<Y!wxYwr)r0r7rgr6) got_exceptionreturned_from_startrsr$rz+TestIOLoop.test_reentrant..callbackLsI ( ""$)-#A& IIK (#' a  (s3AArN)r0r%rGrI assertFalse)rrrrs` @@r$test_reentrantzTestIOLoop.test_reentrantGsY$g   !!(+   a() ,Q/0r&c|jjd|jj|jttd5|j dddy#1swYyxYw)z-Uncaught exceptions get logged by the IOLoop.c ddz SNrrr)r)r&r$r*z3TestIOLoop.test_exception_logging..[ !a%r&Exception in callbackN)r0r%r6rr rGr?s r$test_exception_loggingz!TestIOLoop.test_exception_loggingYsS !!-0 !!$)), w 7 8  IIK   s A,,A5ctjfd}jj|t t d5j dddy#1swYyxYw)z:The IOLoop examines exceptions from Futures and logs them.cZjjjddz yrrr?sr$rz:TestIOLoop.test_exception_logging_future..callbackcs LL % %dii 0 Er&rN)r coroutiner0r%rr rGrrs` r$test_exception_logging_futurez(TestIOLoop.test_exception_logging_future`sX     !!(+ w 7 8  IIK   s AA(cfd}jj|ttd5j dddy#1swYyxYw)z=The IOLoop examines exceptions from awaitables and logs them.cKjjjjjddz ywrrr?sr$rz?TestIOLoop.test_exception_logging_native_coro..callbackos2 LL % %dll&?&? K EsAArN)r0r%rr rGrs` r$"test_exception_logging_native_coroz-TestIOLoop.test_exception_logging_native_corolsE  !!(+ w 7 8  IIK   s A  Ac|jjd|jj|jttd5|j ddd|jj d|jj|jttd5|j dddy#1swYtxYw#1swYyxYw)Nc ddz Srr)r)r&r$r*z0TestIOLoop.test_spawn_callback..|rr&rc ddz Srr)r)r&r$r*z0TestIOLoop.test_spawn_callback..s AEr&)r0r%r6rr rGspawn_callbackr?s r$test_spawn_callbackzTestIOLoop.test_spawn_callbackys !!-0 !!$)), w 7 8  IIK  ##M2 !!$)), w 7 8  IIK        sC<C"C"C+cttj\ jdjdgfd}jj |jj jj |jj jj djjjdgjjy#jjwxYw)Nsabccj|jd|urjjyjjy)Ni)rrecvr0rh)r_r`chunksrrrs r$ handle_readz@TestIOLoop.test_remove_handler_from_handler..handle_readsB bggdm,<LL//7LL//7r&rR) rrrr0rcrerr6rGrri)rrrrrs` @@@r$ test_remove_handler_from_handlerz+TestIOLoop.test_remove_handler_from_handlers **,  KK  KK F 8 LL $ $V[$,,:K:K L LL $ $V[$,,:K:K L LL # #C 3 IIK   VfX . LLN LLN LLN LLNs CD"D7c #Kd}tjtdDcgc]}|jj d| c}ycc}ww)Nc\tdD]}td}|j y)Nr/Frt)rr ri)rr9s r$rz*TestIOLoop.test_init_close_race..fs(2Y 51  r&rE)rmultirr0run_in_executor)rrrs r$test_init_close_racezTestIOLoop.test_init_close_races?  iiaQ155dA>QRRQs A#AActj}t|d}|j|usJ|j t 5t|dddd|j y#1swYxYw)NF) asyncio_loopru)asyncionew_event_loopr rrf RuntimeErrorri)rrr9s r$test_explicit_asyncio_loopz%TestIOLoop.test_explicit_asyncio_loopsl--/  r&cR|j|jjyyr(r0rir?s r$tearDownzTestIOLoopCurrent.tearDowns! << # LL    $r&ctd_jtjdt dD]}fd}jj |jj jjjjtjdy)NFrt)instancerctj_jJjj yr()r currentcurrent_io_loopr0r6r?sr$rz-TestIOLoopCurrent.test_non_current..fs2'-~~'7$||/// !!#r&) r r0 assertIsNonerrr%r7rr)rrrs` r$test_non_currentz"TestIOLoopCurrent.test_non_currents51  &..%89q >A $ LL % %a ( LL   MM$.. =   fnne< = >r&ctd|_|j|jtjy)NTrt)r r0rrr?s r$test_force_currentz$TestIOLoopCurrent.test_force_currents'40  dllFNN$45r&N)rrrr r rrr)r&r$rrs !>&6r&rc.eZdZfdZedZxZS)TestIOLoopCurrentAsynccJt|t|tyr()superr rr)r __class__s r$r zTestIOLoopCurrentAsync.setUps  "4);)=>r&c#Ktd5}|jtjdddy#1swYyxYwwr)rsubmitr r)res r$test_clear_without_currentz1TestIOLoopCurrentAsync.test_clear_without_currents;   " 1a((6//0 0 1 1 1s A"9 AAA)rrrr rr __classcell__)rs@r$rrs?11r&rcBeZdZdZedZedZedZy)TestIOLoopFuturescXtjd5}d}jj|j |fdj }j |jj|jdddy#1swYyxYw)Nrcyr(r)r)r&r$dummyz8TestIOLoopFutures.test_add_future_threads..dummysr&c&j|Sr(r6)futurers r$r*z;TestIOLoopFutures.test_add_future_threads..s499V3Dr&) rrr0 add_futurerrGrIdonerresult)rpoolr$r's` r$test_add_future_threadsz)TestIOLoopFutures.test_add_future_threadss  ' ' * /d  LL # # E"$D YY[F OOFKKM *   fmmo . / / /s BB  B)c#&Ktj}tj}d}tjj d|||tjj d|||g}|j ||g|yw)NcF|j|j|Sr(r|rG self_event other_events r$ sync_funcz=TestIOLoopFutures.test_run_in_executor_gen..sync_funcs NN      r&)rSrr rrr)revent1event2r3ress r$test_run_in_executor_genz*TestIOLoopFutures.test_run_in_executor_gens~""  NN  , ,T9ff M NN  , ,T9ff M   &&)3/sBBc#Ktj}tj}dfd}||||||g}|j||g|yw)NcF|j|j|Sr(r/r0s r$r3z@TestIOLoopFutures.test_run_in_executor_native..sync_funcs NN      r&clKtjjd||d{S7wr()r rr)r1r2r3s r$ async_wrapperzDTestIOLoopFutures.test_run_in_executor_native..async_wrapper s4)99i[ s *424)rSrr)rr4r5r;r6r3s @r$test_run_in_executor_nativez-TestIOLoopFutures.test_run_in_executor_natives[""   #662M&&4QRR &&)3/sAAc#hKdgGfddtj}tjfd}|d}t j }|j ||jd||jdd|jjyw)Nrc"eZdZfdZxZS)?TestIOLoopFutures.test_set_default_executor..MyExecutorc>dxxdz cc<t||g|S)Nrr)rr)rfuncr rcounts r$rzFTestIOLoopFutures.test_set_default_executor..MyExecutor.submit.s$aA w~d2T22r&)rrrrr)rrBs@r$ MyExecutorr?-s  3 3r&rCc&jyr()r|)eventsr$r3z>TestIOLoopFutures.test_set_default_executor..sync_func4s IIKr&r) rrrSrr rset_default_executorrrrIis_set)rrCr3executorr9rBrEs @@r$test_set_default_executorz+TestIOLoopFutures.test_set_default_executor)s 333 3 ! a=~~ !!(+""433 E!H%  'sB.B2N)rrrr,rr7r<rIr)r&r$r!r!sC /00*00*((r&r!cHeZdZdZdZdZdZdZdZdZ dZ d Z d Z y ) TestIOLoopRunSyncc&td|_y)NFrt)r r0r?s r$r zTestIOLoopRunSync.setUp@s51 r&c8|jjyr(r r?s r$r zTestIOLoopRunSync.tearDownCs r&c|jtj5|jj ddddy#1swYyxYw)NcyN*r)r)r&r$r*z4TestIOLoopRunSync.test_sync_result..Hrar&)rfr BadYieldErrorr0rr?s r$test_sync_resultz"TestIOLoopRunSync.test_sync_resultFs=   s00 1 . LL ! !* - . . .s AAc|jt5|jjddddy#1swYyxYw)Nc ddz Srr)r)r&r$r*z7TestIOLoopRunSync.test_sync_exception..Lrr&)rfZeroDivisionErrorr0rr?s r$test_sync_exceptionz%TestIOLoopRunSync.test_sync_exceptionJs8   0 1 1 LL ! !- 0 1 1 1s <Actjd}|j|jj |dy)Nc3XKtjtjdwrP)rmomentReturnr)r&r$rz.TestIOLoopRunSync.test_async_result..fOs** **R. s(*rQ)rrrr0rrrs r$test_async_resultz#TestIOLoopRunSync.test_async_resultNs9  !  ! ..q126r&ctjd}|jt5|jj |dddy#1swYyxYw)Nc3:Ktjddz ywrrrZr)r&r$rz1TestIOLoopRunSync.test_async_exception..fWs**  E)rrrfrVr0rr\s r$test_async_exceptionz&TestIOLoopRunSync.test_async_exceptionVsP      0 1 % LL ! !! $ % % %s AAcFfd}jj|y)Ncbjtjjyr()rr rr0r?sr$rz)TestIOLoopRunSync.test_current..f`s MM&..*DLL 9r&)r0rr\s` r$ test_currentzTestIOLoopRunSync.test_current_s : a r&ctjd}|jt|jj |dy)Nc3:Ktjdywr)rrNr)r&r$rz)TestIOLoopRunSync.test_timeout..ffs))A, rarM)r)rrrfr r0rr\s r$ test_timeoutzTestIOLoopRunSync.test_timeoutes;     , (=(=q$Or&crtjdfd}|jj|y)Nc30Ktjywr(r`r)r&r$f1z3TestIOLoopRunSync.test_native_coroutine..f1ms** sc0Kd{y7wr(r))rksr$f2z3TestIOLoopRunSync.test_native_coroutine..f2qs$JJs )rrr0r)rrmrks @r$test_native_coroutinez'TestIOLoopRunSync.test_native_coroutinels2      b!r&cd}|jt5}|jj|ddddt j vsJy#1swY#xYw)NcKtjdd{tjj tjdd{y7D7w)NrRr/)rrNr rr6r)r&r$rz1TestIOLoopRunSync.test_stop_no_timeout..fwsF--$ $ $ NN  ! ! #--# # # % #s!A$A >A$A"A$"A$zEvent loop stopped)rfrr0rstr exception)rrcms r$test_stop_no_timeoutz&TestIOLoopRunSync.test_stop_no_timeoutvsW $   | , % LL ! !! $ %#s2<<'8888 % %s AA N) rrrr r rSrWr]rbrerhrnrtr)r&r$rKrK?s52.17%! P"9r&rKc6eZdZdZdZdZdZdZdZdZ y) TestPeriodicCallbackMathcg}d}||_|D]=}|j||j|j|j|z}?|S)a9Simulate a series of calls to the PeriodicCallback. Pass a list of call durations in seconds (negative values work to simulate clock adjustments during the call, or more or less equivalently, between calls). This method returns the times at which each call would be made. r~) _next_timeout _update_nextr)rpc durationsrrds r$simulate_callsz'TestPeriodicCallbackMath.simulate_callssZ 'A OOC LL)) *""Q&C ' r&cyr(r)r?s r$r$zTestPeriodicCallbackMath.dummys r&ct|jd}|j|j|dgdzgdy)N'rir r$rr}rrzs r$ test_basicz#TestPeriodicCallbackMath.test_basics9 djj% 0    QC!G ,.L r&cgd}gd}t|jd}|j|j|||y)N) rr/ r#rrrr) rrrri.iLijiiiirr)rcall_durationsexpectedrzs r$ test_overrunz%TestPeriodicCallbackMath.test_overruns@A  djj% 0 ,,R@(Kr&ct|jd}|j|j|gdgd|j|j|gdgdy)Nr)rrr)irr)rrrrrs r$test_clock_backwardsz-TestPeriodicCallbackMath.test_clock_backwardssV djj% 0    $7 8:X  ,,R>@RSr&cgdgd}dgtz}t|jdd}fd}tjd|5|j |j |||dddy#1swYyxYw) N)?rrg?)rg@rgE@rrr)jitterc&jdS)Nr)pop) random_timessr$ mock_randomz9TestPeriodicCallbackMath.test_jitter..mock_randoms##A& &r&z random.random)lenr r$rpatchrr})rrrrzrrs @r$ test_jitterz$TestPeriodicCallbackMath.test_jitters{( 0s<00 djj% < 'ZZ 5 P   T00^Dh O P P Ps #A88Bctdtjdd}d}|j|j|y)Ncyr(r)r)r&r$r*z9TestPeriodicCallbackMath.test_timedelta..rar&r)minutesri8D)r r4r5r callback_time)rrzexpected_callback_times r$test_timedeltaz'TestPeriodicCallbackMath.test_timedeltas9 lH,>,>qRT,U V!& ))+ABr&N) rrrr}r$rrrrrr)r&r$rvrvs)"  L*T" PCr&rvc"eZdZdZddZddZy)TestPeriodicCallbackAsynccddfd }t|d}|jj|jj dy)Nrc<dz dk(rjyy)Nrrr&)rBrsr$rz?TestPeriodicCallbackAsync.test_periodic_plain..callbacks! QJEz r&r/rreturnN)r r7rGr6r)rrrzrBs` @r$test_periodic_plainz-TestPeriodicCallbackAsync.test_periodic_plainsF  h +      "r&Ncddgtjdfd }t|djj j ddj ddy)Nrc3Kdxxdz cc<tjddxxdz cc<ddk(r6jjj jyywNrrg?rrrNr6r0r%countsrzrsr$rz>TestPeriodicCallbackAsync.test_periodic_coro..callbacks_ 1INI))E" " 1INIayA~  ))$))4sA1A4r/rr)rz%Generator[Future[None], object, None])rrr r7rGrrrrrzs` @@r$test_periodic_coroz,TestPeriodicCallbackAsync.test_periodic_corosjQ  5  5h +    A& A&r&cddgdfd }t|djjjddjddy)NrcKdxxdz cc<tjdd{dxxdz cc<ddk(r6jjj jyy7Pwrrrsr$rz?TestPeriodicCallbackAsync.test_periodic_async..callbacksg 1INI))E" " " 1INIayA~  ))$))4 #s&A<A:AA<r/rrr)r r7rGrrs` @@r$test_periodic_asyncz-TestPeriodicCallbackAsync.test_periodic_asyncsYQ 5h +    A& A&r&r)rrrrrrr)r&r$rrs #'$'r&rcjeZdZdZdZdZejejdk\ddZ y)TestIOLoopConfigurationcddgt|z}tjddj|g}t t j |jS)Nz!from tornado.ioloop import IOLoopz*classname = lambda x: x.__class__.__name__z-cz; )listsys executablerUr subprocess check_outputstrip)r statements stmt_listr s r$ run_pythonz"TestIOLoopConfiguration.run_python sX / 8    dii &:;*11$78>>@@r&c|jd}|j|d|jd}|j|dy)N"print(classname(IOLoop.current()))AsyncIOMainLoopzprint(classname(IOLoop())) AsyncIOLooprrrclss r$ test_defaultz$TestIOLoopConfiguration.test_defaultsAooBC /0oo:; m,r&cL|jdd}|j|dy)Nz8IOLoop.configure("tornado.platform.asyncio.AsyncIOLoop")rrrrs r$ test_asyncioz$TestIOLoopConfiguration.test_asyncios)oo F 0  /0r&)rz*implicit event loop creation not availablecN|jddd}|j|dy)Nz4from tornado.platform.asyncio import AsyncIOMainLoopzAsyncIOMainLoop().install()rrrrs r$test_asyncio_mainz)TestIOLoopConfiguration.test_asyncio_mains.oo B ) 0  /0r&N) rrrrrrunittestskipIfr version_inforr)r&r$rrsBA-1X__ G#%Q11r&r__main__)5rconcurrent.futuresr concurrentrcollections.abcrrr4rrrrrSrBr1rrtornado.escapertornadortornado.ioloopr r r tornado.logr tornado.testingr rrrrtornado.test.utilrrtornado.concurrentrtyping TYPE_CHECKINGrrTestCaserrr!rKrvrrrmainr)r&r$rs1%   %AA&  RRn 6))6D 1] 1M( M(`?9))?9DPCx00PCf1' 1'h 1h// 1F zHMMOr&