a 7êdg>“ã@sdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z z ddl Z Wne yndZ Yn0ddlZddlZddlZddlZddlZddlZddlmZddlZejdkrÆddlZddlZddlmZddlmZddlmZddlmZdd lmZdd lm Z dd l!m"Z"dd l!m#Z#m$Z$m%Z%d d„Z&dd„Z'dd„Z(Gdd„dƒZ)Gdd„dej*ƒZ+Gdd„de+ƒZ,Gdd„dej-ƒZ.Gdd„dej*ƒZ/Gdd„dej0ƒZ1Gdd „d ej2ƒZ3Gd!d"„d"ƒZ4Gd#d$„d$ƒZ5ejdkrGd%d&„d&e4ej6ƒZ7Gd'd(„d(e4e5ej6ƒZ8n”ddl9Z9Gd)d*„d*e4ƒZ:e;e9d+ƒrTGd,d-„d-e:e5ej6ƒZGd4d&„d&e:e5ej6ƒZ7d5d6„Z?Gd7d8„d8ej6ƒZ@Gd9d:„d:ej6ƒZAGd;d<„d„d>ej6ƒZCGd?d@„d@ƒZDGdAdB„dBeDej6ƒZEz ddlFZFWne y@Yn0GdCdD„dDeDej6ƒZGGdEdF„dFej6ƒZHGdGdH„dHej6ƒZIeJdIkrŒe K¡dS)JzTests for events.py.éN)ÚmockÚwin32)Ú coroutines)Úevents)Úproactor_events)Úselector_events)Úutils)Úsupport)Ú socket_helper)Ú ALWAYS_EQÚLARGESTÚSMALLESTcCst d¡dS©N)ÚasyncioÚset_event_loop_policy©rrú9/usr/local/lib/python3.9/test/test_asyncio/test_events.pyÚtearDownModule'srcCsFtj d¡rdStjdkrdSt ¡d}ttt| d¡ƒƒ}|dkS)z4Return True if the platform is Mac OS 10.4 or older.ZaixTÚdarwinFrÚ.)é é)ÚsysÚplatformÚ startswithZmac_verÚtupleÚmapÚintÚsplit)ÚversionrrrÚbroken_unix_getsockname+s   r cCs&dd„}t ¡}t |¡| |ƒ¡S)NcÓsdS©NÚhellorrrrrÚdoit7sz8_test_get_event_loop_new_process__sub_proc..doit)rÚnew_event_loopÚset_event_loopÚrun_until_complete)r#ÚlooprrrÚ*_test_get_event_loop_new_process__sub_proc6s r(c@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚCoroLikecCsdSrr)ÚselfÚvrrrÚsend@sz CoroLike.sendcGsdSrr©r*ÚexcrrrÚthrowCszCoroLike.throwcCsdSrr©r*rrrÚcloseFszCoroLike.closecCsdSrrr0rrrÚ __await__IszCoroLike.__await__N)Ú__name__Ú __module__Ú __qualname__r,r/r1r2rrrrr)?sr)c@s>eZdZdZdZd dd„Zdd„Zdd„Zdd „Zd d „Z dS) Ú MyBaseProtoNcCs2d|_d|_d|_|dur.| ¡|_| ¡|_dS©NÚINITIALr)Ú transportÚstateÚnbytesÚ create_futureÚ connectedÚdone©r*r'rrrÚ__init__Qs  zMyBaseProto.__init__cCs6||_|jdksJ|jƒ‚d|_|jr2|j d¡dS©Nr8Ú CONNECTED©r9r:r=Ú set_result©r*r9rrrÚconnection_madeYs zMyBaseProto.connection_madecCs*|jdksJ|jƒ‚|jt|ƒ7_dS©NrB©r:r;Úlen©r*ÚdatarrrÚ data_received`szMyBaseProto.data_receivedcCs|jdksJ|jƒ‚d|_dS)NrBÚEOF©r:r0rrrÚ eof_receiveddszMyBaseProto.eof_receivedcCs0|jdvsJ|jƒ‚d|_|jr,|j d¡dS)N)rBrMÚCLOSED©r:r>rDr-rrrÚconnection_losthszMyBaseProto.connection_lost)N) r3r4r5r=r>r@rFrLrOrRrrrrr6Ms r6cseZdZ‡fdd„Z‡ZS)ÚMyProtocstƒ |¡| d¡dS)Ns%GET / HTTP/1.0 Host: example.com )ÚsuperrFÚwriterE©Ú __class__rrrFps zMyProto.connection_made©r3r4r5rFÚ __classcell__rrrVrrSosrSc@s:eZdZdZd dd„Zdd„Zdd„Zdd „Zd d „ZdS) ÚMyDatagramProtoNcCs"d|_d|_|dur| ¡|_dSr7)r:r;r<r>r?rrrr@xszMyDatagramProto.__init__cCs$||_|jdksJ|jƒ‚d|_dS)Nr8Ú INITIALIZED©r9r:rErrrrF~szMyDatagramProto.connection_madecCs*|jdksJ|jƒ‚|jt|ƒ7_dS©Nr[rH©r*rKÚaddrrrrÚdatagram_receivedƒsz!MyDatagramProto.datagram_receivedcCs|jdksJ|jƒ‚dSr]rNr-rrrÚerror_received‡szMyDatagramProto.error_receivedcCs0|jdksJ|jƒ‚d|_|jr,|j d¡dS)Nr[rPrQr-rrrrRŠszMyDatagramProto.connection_lost)N) r3r4r5r>r@rFr`rarRrrrrrZus  rZc@s:eZdZdZd dd„Zdd„Zdd„Zdd „Zd d „ZdS) ÚMyReadPipeProtoNcCs*dg|_d|_d|_|dur&| ¡|_dSr7)r:r;r9r<r>r?rrrr@”s zMyReadPipeProto.__init__cCs,||_|jdgksJ|jƒ‚|j d¡dSrA)r9r:ÚappendrErrrrF›szMyReadPipeProto.connection_madecCs.|jddgksJ|jƒ‚|jt|ƒ7_dSrArHrJrrrrL szMyReadPipeProto.data_receivedcCs(|jddgksJ|jƒ‚|j d¡dS)Nr8rBrM)r:rcr0rrrrO¤szMyReadPipeProto.eof_receivedcCsPd|jvr|j d¡|jgd¢ks.J|jƒ‚|j d¡|jrL|j d¡dS)NrM)r8rBrMrP)r:rcr>rDr-rrrrR¨s    zMyReadPipeProto.connection_lost)N) r3r4r5r>r@rFrLrOrRrrrrrb‘s  rbc@s*eZdZdZddd„Zdd„Zdd„ZdS) ÚMyWritePipeProtoNcCs"d|_d|_|dur| ¡|_dS)Nr8)r:r9r<r>r?rrrr@´szMyWritePipeProto.__init__cCs$||_|jdksJ|jƒ‚d|_dSrAr\rErrrrFºsz MyWritePipeProto.connection_madecCs0|jdksJ|jƒ‚d|_|jr,|j d¡dS©NrBrPrQr-rrrrR¿sz MyWritePipeProto.connection_lost)N)r3r4r5r>r@rFrRrrrrrd±s rdc@s<eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S)ÚMySubprocessProtocolcsjd|_d|_ˆ ¡|_ˆ ¡|_‡fdd„tdƒDƒ|_dddœ|_d|_t j ˆdt j ˆddœ|_ dS)Nr8csi|]}|ˆ ¡“qSr)r<)Ú.0Úfd©r'rrÚ Íóz1MySubprocessProtocol.__init__..érk©ééri) r:r9r<r=Ú completedÚrangeÚ disconnectsrKÚ returncoderÚEventÚgot_datar?rrirr@Ès     ÿzMySubprocessProtocol.__init__cCs0||_|jdksJ|jƒ‚d|_|j d¡dSrArCrErrrrFÓsz$MySubprocessProtocol.connection_madecCs*|jdksJ|jƒ‚d|_|j d¡dSre)r:rprDr-rrrrRÙsz$MySubprocessProtocol.connection_lostcCs8|jdksJ|jƒ‚|j||7<|j| ¡dSrG)r:rKruÚset)r*rhrKrrrÚpipe_data_receivedÞsz'MySubprocessProtocol.pipe_data_receivedcCs>|jdksJ|jƒ‚|r*|j| |¡n|j| |¡dSrG)r:rrÚ set_exceptionrD)r*rhr.rrrÚpipe_connection_lostãsz)MySubprocessProtocol.pipe_connection_lostcCs$|jdksJ|jƒ‚|j ¡|_dSrG)r:r9Zget_returncodersr0rrrÚprocess_exitedêsz#MySubprocessProtocol.process_exitedN) r3r4r5r@rFrRrwryrzrrrrrfÆs  rfcs0eZdZ‡fdd„Z‡fdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Ze eedƒd¡dd„ƒZe eedƒd ¡d!d"„ƒZe eedƒd ¡d#d$„ƒZdœd&d'„Zd(d)„Zejd*d+„ƒZd%d,ifd-d.„Zdd/d0„Zdžd1d2„Ze e d,ud3¡d4d5„ƒZ!eje e d,ud3¡d6d7„ƒƒZ"d8d9„Z#d:d;„Z$dŸdd?„ƒZ&d@dA„Z'e( )dB¡dCdD„ƒZ*dEdF„Z+dGdH„Z,dIdJ„Z-e ee.dKƒdL¡dMdN„ƒZ/dOdP„Z0ejdQdR„ƒZ1e ee.dSƒdT¡dUdV„ƒZ2d dWdX„Z3d¡dYdZ„Z4d¢d[d\„Z5e e d,ud3¡d]d^„ƒZ6eje e d,ud3¡d_d`„ƒƒZ7e e d,ud3¡dadb„ƒZ8eje e d,ud3¡dcdd„ƒƒZ9e e d,ud3¡dedf„ƒZ:eje e d,ud3¡dgdh„ƒƒZ;e e d,ud3¡didj„ƒZe ej?do¡dpdq„ƒZ@drds„ZAdtdu„ZBdvdw„ZCe ej?do¡dxdy„ƒZDdzd{„ZEd|d}„ZFe eGjHd~kd¡d€d„ƒZIe eGjHd~kd¡d‚dƒ„ƒZJe eGjHd~kd¡d„d…„ƒZKe eGjHd~kd¡d†d‡„ƒZLe eGjHd~kd¡dˆd‰„ƒZMe eGjHd~kd¡eN OdŠd‹¡dŒd„ƒƒZPe eGjHd~kd¡eN OdŠd‹¡dŽd„ƒƒZQdd‘„ZRd’d“„ZSd”d•„ZTd–d—„ZUd˜d™„ZVdšd›„ZW‡ZXS)£ÚEventLoopTestsMixincs$tƒ ¡| ¡|_| |j¡dSr)rTÚsetUpÚcreate_event_loopr'r%r0rVrrr|ñs  zEventLoopTestsMixin.setUpcs4|j ¡st |j¡| ¡t ¡tƒ ¡dSr) r'Ú is_closedÚ test_utilsÚ run_brieflyZ doCleanupsr Ú gc_collectrTÚtearDownr0rVrrr‚ös   zEventLoopTestsMixin.tearDowncsZdd„‰‡‡fdd„}ˆ td¡$ˆ tˆjj|ƒ¡Wdƒn1sL0YdS)NcÓst d¡IdHdS©Nr)rÚsleeprrrrÚcoro1szBEventLoopTestsMixin.test_run_until_complete_nesting..coro1c“s"ˆ ˆj ¡¡ˆj ˆƒ¡dSr)Ú assertTruer'Ú is_runningr&r©r…r*rrÚcoro2szBEventLoopTestsMixin.test_run_until_complete_nesting..coro2zcoroutine \S+ was never awaited)ZassertWarnsRegexÚRuntimeWarningÚ assertRaisesÚ RuntimeErrorr'r&)r*r‰rrˆrÚtest_run_until_complete_nestingÿsþ ÿz3EventLoopTestsMixin.test_run_until_complete_nestingcCsR|j ¡}|j t d¡¡|j ¡}| d||ko@dkn||¡dS)Nçš™™™™™¹?g{®Gáz´?gš™™™™™é?)r'Útimer&rr„r†)r*Út0Út1rrrÚtest_run_until_completes  z+EventLoopTestsMixin.test_run_until_completecs(‡fdd„}|ƒ}ˆ tˆjj|¡dS)Nc“sˆj ¡t d¡IdHdS)NrŽ)r'Ústoprr„rr0rrÚcbs z?EventLoopTestsMixin.test_run_until_complete_stopped..cb)r‹rŒr'r&)r*r”Ztaskrr0rÚtest_run_until_complete_stoppeds  ÿz3EventLoopTestsMixin.test_run_until_complete_stoppedcs>g‰‡‡fdd„}ˆj d|d¡ˆj ¡ˆ ˆdg¡dS)Ncsˆ |¡ˆj ¡dSr©rcr'r“©Úarg©Úresultsr*rrÚcallback#s z5EventLoopTestsMixin.test_call_later..callbackrŽz hello world)r'Ú call_laterÚ run_foreverÚ assertEqual©r*r›rr™rÚtest_call_later s  z#EventLoopTestsMixin.test_call_latercs>g‰‡‡fdd„}ˆj |dd¡ˆj ¡ˆ ˆdg¡dS)Ncsˆ ||f¡ˆj ¡dSrr–)Zarg1Zarg2r™rrr›.sz4EventLoopTestsMixin.test_call_soon..callbackr"Úworld)r"r¡)r'Ú call_soonrržrŸrr™rÚtest_call_soon+s  z"EventLoopTestsMixin.test_call_sooncsžg‰t ¡‰‡‡fdd„‰‡‡‡fdd„}ˆ ¡tj|d}| ¡ˆ(ˆj ˆd¡ˆj ¡Wdƒn1sx0Y| ¡ˆ  ˆddg¡dS)Ncs$ˆ |¡tˆƒdkr ˆj ¡dS©Nro©rcrIr'r“r—r™rrr›:s  z?EventLoopTestsMixin.test_call_soon_threadsafe..callbackcsˆj ˆd¡ˆ ¡dSr!)r'Úcall_soon_threadsafeÚreleaser)r›Úlockr*rrÚ run_in_thread?szDEventLoopTestsMixin.test_call_soon_threadsafe..run_in_thread©Útargetr¡r") Ú threadingÚLockÚacquireÚThreadÚstartr'r¢rÚjoinrž)r*r©Útr)r›r¨ršr*rÚtest_call_soon_threadsafe6s (z-EventLoopTestsMixin.test_call_soon_threadsafecsLg‰‡‡fdd„}ˆj |d¡ˆj |d¡ˆj ¡ˆ ˆddg¡dS)Ncs$ˆ |¡tˆƒdkr ˆj ¡dSr¤r¥r—r™rrr›Ps  zKEventLoopTestsMixin.test_call_soon_threadsafe_same_thread..callbackr"r¡)r'r¦r¢rržrŸrr™rÚ%test_call_soon_threadsafe_same_threadMs  z9EventLoopTestsMixin.test_call_soon_threadsafe_same_threadcCsHdd„}|j d|d¡}|j |¡\}}| |d¡| |t ¡¡dS)NcSs |t ¡fSr)r¬Ú get_identr—rrrÚrun[sz5EventLoopTestsMixin.test_run_in_executor..runZyo)r'Úrun_in_executorr&ržZassertNotEqualr¬rµ)r*r¶Úf2ÚresZ thread_idrrrÚtest_run_in_executorZs  z(EventLoopTestsMixin.test_run_in_executorcsrd‰‡fdd„}dd„}|j d|¡}| ¡|j |j ¡¡|j ¡||j_||j_t  d¡|  ˆ¡dS)NFcsd‰dS©NTr©Úargs©ZcalledrrÚpatched_call_sooneszJEventLoopTestsMixin.test_run_in_executor_cancel..patched_call_sooncSst d¡dS)Ngš™™™™™©?)rr„rrrrr¶isz.rungš™™™™™Ù?) r'r·Úcancelr&Zshutdown_default_executorr1r¢r¦rr„Ú assertFalse)r*r¿r¶r¸rr¾rÚtest_run_in_executor_cancelbs ÿ  z/EventLoopTestsMixin.test_run_in_executor_cancelcsÂt ¡\‰}ˆ d¡tƒ‰‡‡‡fdd„}ˆj ˆ ¡|¡ˆj |jd¡t   ˆj‡fdd„¡ˆj |jd¡t   ˆj‡fdd„¡ˆj |j ¡ˆj ˆjj ¡ˆj  ¡ˆ ˆd ¡dS) NFcsVzˆ d¡}Wnty"YdS0|r4ˆ |¡nˆ ˆj ˆ ¡¡¡ˆ ¡dS©Né)ÚrecvÚBlockingIOErrorÚextendr†r'Ú remove_readerÚfilenor1©rK©Ú bytes_readÚrr*rrÚreader{s  z8EventLoopTestsMixin.test_reader_callback..readersabccs tˆƒdkS)Nrl©rIr©rÌrrÚŠrkz:EventLoopTestsMixin.test_reader_callback..sdefcs tˆƒdkS)NérÏrrÐrrrÑŒrksabcdef)ÚsocketÚ socketpairÚ setblockingÚ bytearrayr'Ú add_readerrÉr¢r,rÚ run_untilr1r“rrž)r*ÚwrÎrrËrÚtest_reader_callbackvs    z(EventLoopTestsMixin.test_reader_callbackcs¤t ¡\}‰ˆ d¡‡‡fdd„}d}ˆj ˆ ¡||¡ˆj ¡ˆ ˆj ˆ ¡¡¡ˆ  ˆj ˆ ¡¡¡ˆ  ¡|  t |ƒd¡}|  ¡ˆ  ||¡dS)NFcsˆ |¡ˆj ¡dSr)r,r'r“rÊ©r*rÙrrÚwriter–s z8EventLoopTestsMixin.test_writer_callback..writersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxro)rÓrÔrÕr'Ú add_writerrÉrr†Ú remove_writerrÁr1rÅrIrž)r*rÍrÜrKÚreadrrÛrÚtest_writer_callback’s   z(EventLoopTestsMixin.test_writer_callbackÚSIGKILLz No SIGKILLcsXd‰‡fdd„}| t|jjd|¡| t|jjd¡| t|jjtjd|¡| t|jjtjd¡| t|jjd|¡| t|jjd¡| t|jjd|¡| t|jjd¡| t|jjtj |¡|  |j tj ¡¡|j tj |¡t   t  ¡tj ¡t |j‡fdd„¡| |j tj ¡¡| t tj ¡tj¡|  |j tj ¡¡dS) Nrcs ˆd7‰dS©Nrnrr©ÚcaughtrrÚ my_handlerªsz?EventLoopTestsMixin.test_add_signal_handler..my_handlerZboomrnéÿÿÿÿcsˆSrrrrãrrrÑÉrkz=EventLoopTestsMixin.test_add_signal_handler..)r‹Ú TypeErrorr'Úadd_signal_handlerÚremove_signal_handlerÚ ValueErrorÚsignalÚNSIGrŒrárÁÚSIGINTÚosÚkillÚgetpidrrØr†ržÚ getsignalÚdefault_int_handler©r*rårrãrÚtest_add_signal_handler¦sP  ÿ ÿþÿ ÿ ÿ ÿ ÿ þÿz+EventLoopTestsMixin.test_add_signal_handlerÚSIGALRMz No SIGALRMcs^d‰‡‡fdd„}ˆj tj|¡t tjdd¡ˆj dˆjj¡ˆj ¡ˆ  ˆd¡dS)Nrcsˆd7‰ˆj ¡dSrâ)r'r“r©rär*rrrå×szLEventLoopTestsMixin.test_signal_handling_while_selecting..my_handlerç{®Gáz„?é<rn© r'rèrërõÚ setitimerÚ ITIMER_REALrœr“rržrórrörÚ$test_signal_handling_while_selectingÒs z8EventLoopTestsMixin.test_signal_handling_while_selectingcsld‰d‰‡‡‡fdd„}ˆjjtj|gˆ¢RŽt tjdd¡ˆj dˆjj¡ˆj ¡ˆ  ˆd¡dS)N)é*rcs"ˆd7‰ˆ |ˆ¡ˆj ¡dSrâ)ržr'r“r¼©rär*Z some_argsrrråès zAEventLoopTestsMixin.test_signal_handling_args..my_handlerrŽrørnrùrórrþrÚtest_signal_handling_argsãs z-EventLoopTestsMixin.test_signal_handling_argsTcCsv|j |¡\}}| |tj¡| |tj¡| |j|¡|rN| |  d¡¡|j |j ¡|  |j d¡|  ¡dS)NÚsocknamer)r'r&ÚassertIsInstancerÚ TransportÚProtocolÚassertIsr9ÚassertIsNotNoneÚget_extra_infor>Ú assertGreaterr;r1)r*Úconnection_futÚcheck_socknameÚtrÚprrrrÚ_basetest_create_connectionõsz/EventLoopTestsMixin._basetest_create_connectioncsTt ¡8}ˆjj‡fdd„g|j¢RŽ}ˆ |¡Wdƒn1sF0YdS)Ncs tˆjdS©Nri©rSr'rr0rrrÑrkz.)rÚrun_test_serverr'Úcreate_connectionÚaddressr )r*ÚhttpdÚconn_futrr0rÚtest_create_connections  ÿÿz*EventLoopTestsMixin.test_create_connectioncsXtƒ }t ¡4}ˆj ‡fdd„|j¡}ˆ ||¡Wdƒn1sJ0YdS)Ncs tˆjdSr rrr0rrrÑrkzAEventLoopTestsMixin.test_create_unix_connection..)r rÚrun_test_unix_serverr'Úcreate_unix_connectionrr )r*r rrrr0rÚtest_create_unix_connections  ÿz/EventLoopTestsMixin.test_create_unix_connectionNcCs|r| | d¡¡|r,| || d¡¡n| | d¡¡| || d¡¡| d¡}| |t¡| t|ƒd|¡| |dt¡| |dt¡| |dt¡| d ¡}| |¡| | ¡| d ¡¡| |  ¡| d¡¡| |  ¡| d¡¡| | ¡| d ¡¡dS) NrÚpeernameÚpeercertÚcipherrlrrnroZ ssl_objectÚ compression) rrržrrrIÚstrrrrZ getpeercert)r*Úclientr rrrZsslobjrrrÚcheck_ssl_extra_infos<ÿÿ     ÿ ÿ ÿ ÿz(EventLoopTestsMixin.check_ssl_extra_infocCsx|j |¡\}}| |tj¡| |tj¡| d|jj  ¡v¡|  |||¡|j |j ¡|  |j d¡| ¡dS)NÚsslr)r'r&rrrrr†rWr3Úlowerrr>rr;r1)r*rr rr r rrrÚ_basetest_create_ssl_connection1sz3EventLoopTestsMixin._basetest_create_ssl_connectionc s|t ¡d}ˆ |||¡ttdƒr˜tjjfddddœ‡fdd„ }tjd|d6}|dd}ˆ |||¡ˆ  |j d ¡Wdƒn1sŽ0Yˆ  tj ¡P}|dd}t  ¡ˆ |||¡Wdƒn1sÜ0YWdƒn1sú0Yˆ  |jjd ¡dS) N©rÚPurpose)ÚcafileÚcapathÚcadatacsˆ |tjj¡t ¡S)z A ssl.create_default_context() replacement that doesn't enable cert validation. )ržrr#Ú SERVER_AUTHrÚdummy_ssl_context)Zpurposer$r%r&r0rrÚ_dummy_ssl_create_contextEszREventLoopTestsMixin._test_create_ssl_connection.._dummy_ssl_create_contextzssl.create_default_context)Ú side_effectTrnZCERTIFICATE_VERIFY_FAILED)rr(r!Úhasattrrr#r'rÚpatchržZ call_countr‹ÚSSLErrorÚdisable_loggerÚ exceptionÚreason) r*rrr rrr)ÚmÚcmrr0rÚ_test_create_ssl_connection=s2ÿ þ ÿ ÿ,  ÿ@z/EventLoopTestsMixin._test_create_ssl_connectionz No ssl modulecsdtjddD}tjˆjj‡fdd„g|j¢RŽ}ˆj|||jdWdƒn1sV0YdS)NT©Zuse_sslcs tˆjdSr rrr0rrrÑgrkz@EventLoopTestsMixin.test_create_ssl_connection..©r)rrÚ functoolsÚpartialr'rrr3)r*rrrr0rÚtest_create_ssl_connectionbs þýÿz.EventLoopTestsMixin.test_create_ssl_connectioncsltƒ }tjddD}tjˆjj‡fdd„|jdd}ˆj||||jdWdƒn1s^0YdS)NTr4cs tˆjdSr rrr0rrrÑvrkzEEventLoopTestsMixin.test_create_ssl_unix_connection..ú 127.0.0.1)Úserver_hostnamer5) r rrr6r7r'rrr3)r*r rrrr0rÚtest_create_ssl_unix_connectionlsýþz3EventLoopTestsMixin.test_create_ssl_unix_connectioncs–t ¡z}t ¡}ˆjj‡fdd„g|j¢Rd|jd|fiŽ}ˆj |¡\}}|j  d¡d}ˆ  ||¡|  ¡Wdƒn1sˆ0YdS)Ncs tˆjdSr rrr0rrrÑrkzGEventLoopTestsMixin.test_create_connection_local_addr..Ú local_addrrrrn) rrr Úfind_unused_portr'rrr&r9rržr1)r*rÚportÚfr r Zexpectedrr0rÚ!test_create_connection_local_addr}s  ÿþ þ z5EventLoopTestsMixin.test_create_connection_local_addrc s°t ¡”}ˆjj‡fdd„g|j¢Rd|jiŽ}ˆ t¡}ˆj |¡Wdƒn1s\0Yˆ |j j t j ¡ˆ  t |jƒ|j j¡Wdƒn1s¢0YdS)Ncs tˆjdSr rrr0rrrÑ‹rkzNEventLoopTestsMixin.test_create_connection_local_addr_in_use..r<)rrr'rrr‹ÚOSErrorr&ržr/ÚerrnoÚ EADDRINUSEÚassertInrÚstrerror)r*rr?r2rr0rÚ(test_create_connection_local_addr_in_useˆs  ÿþþ *z.MyProtocstƒ |¡ˆ ˆj¡dSr)rTrRr¢r“r-)rWr'rrrR—s zQEventLoopTestsMixin.test_connect_accepted_socket..MyProto.connection_lostcstƒ |¡|j ˆ¡dSr)rTrLr9rUrJ)rWÚexpected_responserrrL›s zOEventLoopTestsMixin.test_connect_accepted_socket..MyProto.data_received)r3r4r5rRrLrYr)rGr'rVrrS•srS©r9rrn)Úbacklogs test datasrogerc sxzDt ¡}ˆdurˆ |¡}| ˆ¡| ˆ¡| d¡‰| ¡Wn.tyr}ztd|ƒWYd}~n d}~00dS)Nécz8Failure in client thread in test_connect_accepted_socket)rÓZ wrap_socketÚconnectÚsendallrÅr1Ú ExceptionÚprint)Zcsockr.)r_Ú client_sslÚmessageÚresponserrr¦s     þz@EventLoopTestsMixin.test_connect_accepted_socket..clientT)r«ÚdaemonricsˆSrrr©ÚprotorrrѽrkzBEventLoopTestsMixin.test_connect_accepted_socket..r"rP)r'r6rÓÚ create_serverÚ getsocknamer¬r¯r°Úacceptr&Úconnect_accepted_socketrr9r1r Ú join_threadrÁÚis_aliveržr:r;rI) r*Z server_sslrOrSZlsockrÚthreadÚconnÚ_r)r_rOrGr'rPrTrQrÚtest_connect_accepted_socket’s4   ÿÿ  z0EventLoopTestsMixin.test_connect_accepted_socketcCsLtjdkr,tjdkr,t|jtjƒr,t d¡‚t   ¡}t   ¡}|  ||¡dS)Nr)rlrz=SSL not supported with proactor event loops before Python 3.5) rrÚ version_infoÚ isinstancer'rZBaseProactorEventLoopÚunittestÚSkipTestrZsimple_server_sslcontextZsimple_client_sslcontextr^)r*Zserver_contextZclient_contextrrrÚ test_ssl_connect_accepted_socketÈs ÿ þÿz4EventLoopTestsMixin.test_ssl_connect_accepted_socketcCsdt ¡}| |j¡|jjt|tjd}| t d¡|j  |¡Wdƒn1sV0YdS)N)Zssl_handshake_timeoutz1ssl_handshake_timeout is only meaningful with ssl) rÓÚ addCleanupr1r'rXrSr ZLOOPBACK_TIMEOUTÚassertRaisesRegexrêr&)r*ÚsockÚcororrrÚ9test_connect_accepted_socket_ssl_timeout_for_plain_socket×s ÿþzMEventLoopTestsMixin.test_connect_accepted_socket_ssl_timeout_for_plain_socketzasyncio.base_events.socketc sʇfdd„‰‡‡fdd„}t|ƒ}ˆtjkrDdd„|Dƒ| ¡j_ndd„|Dƒ| ¡j_|ˆj_t ¡ˆj_ t ¡ˆj_ ˆj  ‡fdd „|d ¡}ˆj  |¡}ˆ  |j¡d d „|jDƒ}ˆ ||¡dS) NcŸs>ˆtjkr ˆtjdd||ffgSˆtjdd||ddffgSdS)NrÒÚr)rÓÚAF_INETÚ SOCK_STREAM)Úhostr>r½Úkw)ÚfamilyrrÚ getaddrinfoãs zEEventLoopTestsMixin.create_server_multiple_hosts..getaddrinfocsˆj ˆ|i|¤Ž¡Sr)r'Ú create_task)r½Úkwds)ror*rrÚgetaddrinfo_taskészJEventLoopTestsMixin.create_server_multiple_hosts..getaddrinfo_taskcSsg|] }|df‘qS)éPr©rgrlrrrÚ ïszDEventLoopTestsMixin.create_server_multiple_hosts..cSsg|]}|dddf‘qS)rsrrrtrrrruòscs tˆjƒSrrrr0rrrÑ÷rkzBEventLoopTestsMixin.create_server_multiple_hosts..rscSsh|]}| ¡d’qS)r)Ú getsockbyname)rgrfrrrÚ úrkzCEventLoopTestsMixin.create_server_multiple_hosts..)rvrÓrjrvr*r'rorÚMockZ_start_servingÚ _stop_servingrUr&rdr1Úsocketsrž) r*rnZhostsZ mock_sockrrZ unique_hostsr?ÚserverZ server_hostsr)rnror*rÚcreate_server_multiple_hostsás$  ÿÿ    z0EventLoopTestsMixin.create_server_multiple_hostscCs| tjgd¢¡dS)N)ú1.2.3.4z5.6.7.8r})r|rÓrjr0rrrÚ&test_create_server_multiple_hosts_ipv4ýsÿz:EventLoopTestsMixin.test_create_server_multiple_hosts_ipv4cCs| tjgd¢¡dS)N)ú::1z::2r)r|rÓÚAF_INET6r0rrrÚ&test_create_server_multiple_hosts_ipv6sÿz:EventLoopTestsMixin.test_create_server_multiple_hosts_ipv6cs&t|jƒ‰|j ‡fdd„dd¡}|j |¡}| t|jƒd¡|jd}| ¡\}}| |d¡t ¡}|  d|f¡|  d¡|j ˆj ¡| dˆj ¡t  |j‡fd d„¡| d ˆj¡| ˆj d ¡¡| dˆj d ¡d¡ˆj ¡|j ˆj¡| d ˆj ¡| ¡| ¡dS)NcsˆSrrrrSrrrÑrkz8EventLoopTestsMixin.test_create_server..ú0.0.0.0rrnr9óxxxrBcs ˆjdkSrƒ©r;rrSrrrÑrkrlrrrP)rSr'rUr&ržrIrzrVrÓrKrLr=r:rrØr;rr9rr1r>©r*r?r{rfrlr>rrrSrÚtest_create_servers.      ÿ z&EventLoopTestsMixin.test_create_serverÚ SO_REUSEPORTzNo SO_REUSEPORTcsät|jƒ‰|j ‡fdd„dd¡}|j |¡}| t|jƒd¡|jd}| | t j t j ¡¡|  ¡t  |j¡t|jƒ‰|jj‡fdd„dddd}|j |¡}| t|jƒd¡|jd}| | t j t j ¡¡|  ¡dS) NcsˆSrrrrSrrrÑ-rkzCEventLoopTestsMixin.test_create_server_reuse_port..r‚rrncsˆSrrrrSrrrÑ:rkT)Ú reuse_port)rSr'rUr&ržrIrzrÁÚ getsockoptrÓÚ SOL_SOCKETr‡r1rr€r†)r*r?r{rfrrSrÚtest_create_server_reuse_port)s6 ÿ  ÿÿ  ÿ  ÿÿz1EventLoopTestsMixin.test_create_server_reuse_portc sDt ¡‰| ‡fdd„¡|jj|ˆfi|¤Ž}|j |¡}|ˆfS)Ncstj ˆ¡ot ˆ¡Sr)rîÚpathÚexistsÚunlinkr©rŒrrrÑErkz7EventLoopTestsMixin._make_unix_server..)rZgen_unix_socket_pathrdr'Úcreate_unix_serverr&)r*ÚfactoryÚkwargsr?r{rrrÚ_make_unix_serverCs  z%EventLoopTestsMixin._make_unix_servercsÎt|jd‰| ‡fdd„¡\}}| t|jƒd¡t tj¡}| |¡|  d¡|j  ˆj ¡| dˆj ¡t  |j‡fdd„¡| dˆj¡ˆj ¡|j  ˆj¡| d ˆj ¡| ¡| ¡dS) NricsˆSrrrrSrrrÑOrkz=EventLoopTestsMixin.test_create_unix_server..rnrƒrBcs ˆjdkSrƒr„rrSrrrÑXrkrlrP)rSr'r“ržrIrzrÓÚAF_UNIXrKrLr&r=r:rrØr;r9r1r>)r*r{rŒrrrSrÚtest_create_unix_serverLs     z+EventLoopTestsMixin.test_create_unix_serverr”zNo UNIX Socketsc sŽt|jd‰t ¡}|b|jj‡fdd„d|d}| td¡|j |¡Wdƒn1sb0YWdƒn1s€0YdS)NricsˆSrrrrSrrrÑmrkzOEventLoopTestsMixin.test_create_unix_server_path_socket_error..z/test©rfz3path and sock can not be specified at the same time)rSr'rÓrrerêr&)r*rfr?rrSrÚ)test_create_unix_server_path_socket_errorhs ÿz=EventLoopTestsMixin.test_create_unix_server_path_socket_errorcCs,t tj¡}|jtjO_| ||¡|Sr)rÚ SSLContextZPROTOCOL_TLS_SERVERÚoptionsÚ OP_NO_SSLv2Zload_cert_chain)r*ÚcertfileÚkeyfileÚ sslcontextrrrÚ_create_ssl_contextss  z'EventLoopTestsMixin._create_ssl_contextc CsX| ||¡}|jj|dd|d}|j |¡}|jd}| ¡\}} | |d¡||| fS)Nr9rr")ržr'rUr&rzrVrž) r*r‘r›rœrr?r{rfrlr>rrrÚ_make_ssl_serverys     z$EventLoopTestsMixin._make_ssl_servercCs| ||¡}|j||dS)Nr")ržr“)r*r‘r›rœrrrrÚ_make_ssl_unix_server„s z)EventLoopTestsMixin._make_ssl_unix_servercsêt|jd‰| ‡fdd„tjtj¡\}}}|jjt||t ¡d}|j  |¡\}}|  d¡|j  ˆj ¡|  dˆj ¡t |j‡fdd„¡|  dˆj¡|j|||fd ˆj ¡|j  ˆj¡|  d ˆj ¡| ¡| ¡dS) NricsˆSrrrrSrrrÑŒrkz.r"rƒrBcs ˆjdkSrƒr„rrSrrrÑ–rkrlr5rP)rSr'rŸrÚONLYCERTÚONLYKEYrr6r(r&rUr=ržr:rØr;rr9r1r>)r*r{rlr>Úf_crr rrSrÚtest_create_server_sslˆs& ÿ  ÿ  z*EventLoopTestsMixin.test_create_server_sslcsÖt|jd‰| ‡fdd„tjtj¡\}}|jjt|t ¡dd}|j  |¡\}}|  d¡|j  ˆj ¡|  dˆj ¡t |j‡fdd„¡|  d ˆj¡ˆj ¡|j  ˆj¡|  d ˆj ¡| ¡| ¡dS) NricsˆSrrrrSrrrÑ­rkzAEventLoopTestsMixin.test_create_unix_server_ssl..ri©rr:rƒrBcs ˆjdkSrƒr„rrSrrrѸrkrlrP)rSr'r rr¡r¢rr6r(r&rUr=ržr:rØr;r9r1r>)r*r{rŒr£rr rrSrÚtest_create_unix_server_ssl¨s& ÿ þ  z/EventLoopTestsMixin.test_create_unix_server_sslc s(t|jd‰| ‡fdd„tj¡\}}}t tj¡}|jtj O_tj |_ t |dƒr\d|_ |jjt|||d}tj |jd¡~t ¡J| tjd¡|j |¡Wdƒn1s¼0YWdƒn1sÚ0Yt |j¡Wdƒn1s0Y| ˆj¡| ¡dS) NricsˆSrrrrSrrrÑËrkzJEventLoopTestsMixin.test_create_server_ssl_verify_failed..Úcheck_hostnameTr"Úcall_exception_handlerú(?i)certificate.verify.failed)rSr'rŸrÚSIGNED_CERTFILErr˜ÚPROTOCOL_TLS_CLIENTr™ršÚ CERT_REQUIREDÚ verify_moder+r§rrr,Úobjectr.rer-r&r€Ú assertIsNoner9r1©r*r{rlr>Ússlcontext_clientr£rrSrÚ$test_create_server_ssl_verify_failedÇs* ÿ    ÿ ÿH, z8EventLoopTestsMixin.test_create_server_ssl_verify_failedc s&t|jd‰| ‡fdd„tj¡\}}t tj¡}|jtj O_tj |_ t |dƒrZd|_ |jjt||dd}tj |jd¡~t ¡J| tjd ¡|j |¡Wdƒn1sº0YWdƒn1sØ0Yt |j¡Wdƒn1s0Y| ˆj¡| ¡dS) NricsˆSrrrrSrrrÑérkzOEventLoopTestsMixin.test_create_unix_server_ssl_verify_failed..r§TÚinvalidr¥r¨r©)rSr'r rrªrr˜r«r™ršr¬r­r+r§rrr,r®r.rer-r&r€r¯r9r1)r*r{rŒr±r£rrSrÚ)test_create_unix_server_ssl_verify_failedäs, ÿ   þ ÿH, z=EventLoopTestsMixin.test_create_unix_server_ssl_verify_failedc s*t|jd‰| ‡fdd„tj¡\}}}t tj¡}|jtj O_tj |_ |j tj dt|dƒrjd|_|jjt|||d}tj |jd¡rt ¡J| tjd ¡|j |¡Wdƒn1sÊ0YWdƒn1sè0YWdƒn1s0Y| ˆj¡| ¡dS) NricsˆSrrrrSrrrÑrkzIEventLoopTestsMixin.test_create_server_ssl_match_failed..©r$r§Tr"r¨z=IP address mismatch, certificate is not valid for '127.0.0.1')rSr'rŸrrªrr˜r«r™ršr¬r­Úload_verify_locationsÚ SIGNING_CAr+r§rrr,r®r.reZCertificateErrorr&r¯r9r1r°rrSrÚ#test_create_server_ssl_match_faileds0 ÿ  ÿ  ÿ þh z7EventLoopTestsMixin.test_create_server_ssl_match_failedcsÆt|jd‰| ‡fdd„tj¡\}}t tj¡}|jtj O_tj |_ |j tj dt|dƒrhd|_|jjt||dd}|j |¡\}}|j ˆj¡ˆj ¡| ¡| ¡|j ˆj¡dS) NricsˆSrrrrSrrrÑ%rkzJEventLoopTestsMixin.test_create_unix_server_ssl_verified..rµr§TÚ localhostr¥)rSr'r rrªrr˜r«r™ršr¬r­r¶r·r+r§rr&r=r9r1r>)r*r{rŒr±r£rr rrSrÚ$test_create_unix_server_ssl_verified s( ÿ   þ z8EventLoopTestsMixin.test_create_unix_server_ssl_verifiedcsàt|jd‰| ‡fdd„tj¡\}}}t tj¡}|jtj O_tj |_ |j tj dt|dƒrjd|_|jjt|||dd}|j |¡\}}|j ˆj¡|j|||ftjd ˆj ¡| ¡| ¡|j ˆj¡dS) NricsˆSrrrrSrrrÑ?rkzEEventLoopTestsMixin.test_create_server_ssl_verified..rµr§Tr¹r¥)rr)rSr'rŸrrªrr˜r«r™ršr¬r­r¶r·r+r§rr&r=rZPEERCERTr9r1r>)r*r{rlr>r±r£rr rrSrÚtest_create_server_ssl_verified;s. ÿ    þ ÿ z3EventLoopTestsMixin.test_create_server_ssl_verifiedc s®|j ¡‰G‡fdd„dtƒ}t d¡}|jj||d}|j |¡}|jd}| | ¡| ¡¡|  ¡\}}| |d¡t ¡}|  d|f¡|  d¡|  ¡|  ¡dS) NcseZdZ‡‡fdd„Z‡ZS)z@EventLoopTestsMixin.test_create_server_sock..TestMyProtocstƒ |¡ˆ |¡dSr©rTrFrDrE)rWrTrrrF]s zPEventLoopTestsMixin.test_create_server_sock..TestMyProto.connection_maderXrrSrVrÚ TestMyProto\sr½©r‚rr–rr‚r9rƒ) r'r<rSrÓrUr&rzržrÉrVrKr,r1) r*r½Úsock_obr?r{rfrlr>rrrSrÚtest_create_server_sockYs       z+EventLoopTestsMixin.test_create_server_sockcCs¢t d¡}|jjt|d}|j |¡}|jd}| ¡\}}|jjt||d}| t¡}|j |¡Wdƒn1sz0Y|  |j j t j ¡|  ¡dS)Nr¾r–r©rlr>)rÓrUr'rSr&rzrVr‹rAržr/rBrCr1)r*r¿r?r{rfrlr>r2rrrÚtest_create_server_addr_in_useps     *z2EventLoopTestsMixin.test_create_server_addr_in_usezIPv6 not supported or enabledc s<|j ¡‰G‡fdd„dtƒ}d}z*t ¡}|jj|d|d}|j |¡}Wq¦ty }z<|jtj krŠ|d7}|  d|¡WYd}~q"n‚WYd}~q"d}~00q¦q"t   ¡}|  d|f¡|  d¡|j ˆ¡}|j ¡| ¡|j ¡‰t   t j¡}|  d |f¡|  d¡|j ˆ¡}|j ¡| ¡| ¡dS) NcseZdZ‡‡fdd„Z‡ZS)zFEventLoopTestsMixin.test_create_server_dual_stack..TestMyProtocstƒ |¡ˆ |¡dSrr¼rE)rWÚf_protorrrF„s zVEventLoopTestsMixin.test_create_server_dual_stack..TestMyProto.connection_maderXr©rÃrVrr½ƒsr½rrÁrnrr9rƒr)r'r<rSr r=rUr&rArBrCZassertGreaterEqualrÓrKr,r9r1r€) r*r½Z try_countr>r?r{ÚexrrTrrÄrÚtest_create_server_dual_stacks8           z1EventLoopTestsMixin.test_create_server_dual_stackcCsŠ|j tdd¡}|j |¡}|jd}| ¡\}}t ¡}| d|f¡| d¡|  ¡|  ¡t ¡}|  t |jd|f¡|  ¡dS)Nr‚rr9rƒ) r'rUrSr&rzrVrÓrKr,r1r‹ÚConnectionRefusedErrorr…rrrÚtest_server_close¨s     ÿz%EventLoopTestsMixin.test_server_closec s„G‡fdd„dtƒ}ˆjj|||d}ˆj |¡\}‰| d¡}t |tjtjB¡\}}ˆ  |t j ¡ˆ  ˆ|¡ˆ  dˆj ¡ˆ ˆj|¡ˆjj‡fdd„||fd}ˆj |¡\} ‰ˆ  | t j ¡ˆ  ˆt¡ˆ  dˆj ¡ˆ ˆj| ¡|  d ¡t ˆj‡fd d„¡ˆ  d ˆj¡t ˆj‡fd d„¡ˆ  d ˆj¡ˆ |  d¡¡|  ¡ˆj ˆj¡ˆ  dˆj ¡ˆj ¡dS)Ncs*eZdZ‡‡fdd„Z‡fdd„Z‡ZS)zOEventLoopTestsMixin._test_create_datagram_endpoint..TestMyDatagramProtocstƒjˆjddSr )rTr@r')Z inner_self)rWr*rrr@¼szXEventLoopTestsMixin._test_create_datagram_endpoint..TestMyDatagramProto.__init__cs$tƒ ||¡|j d||¡dS)Nsresp:)rTr`r9Úsendtor^rVrrr`¿szaEventLoopTestsMixin._test_create_datagram_endpoint..TestMyDatagramProto.datagram_received)r3r4r5r@r`rYrr0rVrÚTestMyDatagramProto»srÊ)r<rnrr[cs tˆjdSr ©rZr'rr0rrrÑÐrkzDEventLoopTestsMixin._test_create_datagram_endpoint..)Z remote_addrrƒcsˆjSrr„r)r{rrrÑÚrkrlcsˆjSrr„r)rrrrÑÜrkérP)rZr'Úcreate_datagram_endpointr&rrÓÚ getnameinfoÚNI_NUMERICHOSTÚNI_NUMERICSERVrrrržr:rr9rÉrrØr;rr1r>) r*r<rnrÊrgZ s_transportrrlr>r9r)rr*r{rÚ_test_create_datagram_endpointºs@ÿ  ÿ  þ  z2EventLoopTestsMixin._test_create_datagram_endpointcCs| dtj¡dS)NrH)rÑrÓrjr0rrrÚtest_create_datagram_endpointêsz1EventLoopTestsMixin.test_create_datagram_endpointcCs| dtj¡dS)N)rr)rÑrÓr€r0rrrÚ"test_create_datagram_endpoint_ipv6ísz6EventLoopTestsMixin.test_create_datagram_endpoint_ipv6c sÚd}d}ˆj ˆjj|dtjiŽ¡}|D]H\}}}}}z(tj|||d}| d¡| |¡Wn Yq(0q~q(ds~Jdƒ‚ˆjj‡fdd„|d} ˆj | ¡\} } ˆ | t j ¡ˆ | t ¡|   ¡ˆj | j ¡dS) NrHÚtype)rnrÔrTFzCan not create socket.cs tˆjdSr rËrr0rrrÑrkzHEventLoopTestsMixin.test_create_datagram_endpoint_sock..r–)r'r&rorÓÚ SOCK_DGRAMrÕÚbindrÍrrrrZr1r>) r*rfZ local_addressZinfosrnrÔrTZcnamerr?r r rr0rÚ"test_create_datagram_endpoint_sockñs4ÿÿÿ   ÿ z6EventLoopTestsMixin.test_create_datagram_endpoint_sockcCsf| ¡}t|tjƒs&| ¡| d¡| d|j¡| ¡| d|j¡| |j ¡| |j ¡dS)Nz#loop is not a BaseSelectorEventLooprnr) r}r`rZBaseSelectorEventLoopr1ZskipTestržZ _internal_fdsr¯Z_csockZ_ssockr?rrrÚtest_internal_fds s   z%EventLoopTestsMixin.test_internal_fdsrzDon't support pipes for Windowscsötˆjd‰t ¡\}}t |dd¡‰‡‡‡fdd„}ˆj |ƒ¡t |d¡t  ˆj‡fdd„¡ˆ  d ˆj ¡t |d ¡t  ˆj‡fd d„¡ˆ  d d gˆj ¡ˆ  dˆj ¡t  |¡ˆj ˆj¡ˆ  gd¢ˆj ¡ˆ ˆj d¡¡dS)NriÚrbrÄc“s^ˆj ‡fdd„ˆ¡IdH\}}ˆ |ˆ¡ˆ |ˆj¡ˆ ddgˆj¡ˆ dˆj¡dS)NcsˆSrrrrSrrrÑ!rkzEEventLoopTestsMixin.test_read_pipe..connect..r8rBr©r'Úconnect_read_piperr9ržr:r;©r²Úp©ÚpipeobjrTr*rrrKs ÿ z3EventLoopTestsMixin.test_read_pipe..connectó1cs ˆjdkSrâr„rrSrrrÑ*rkz4EventLoopTestsMixin.test_read_pipe..rnó2345cs ˆjdkS©Nrr„rrSrrrÑ.rkr8rBr©r8rBrMrPÚpipe)rbr'rîräÚioÚopenr&rUrrØržr;r:r1r>rr9r)r*ÚrpipeÚwpiperKrrÞrÚtest_read_pipes$      ÿz"EventLoopTestsMixin.test_read_pipecs°| ¡‰tˆd‰tˆd‰t ¡\}}t |dd¡‰t |dd¡‰‡‡‡‡‡fdd„}ˆ |ƒ¡\}}ˆ ¡|  dt |ƒ¡|  dt |ƒ¡ˆ ¡ˆ ¡d|_ d|_ dS)NrirÙrÄrÙc“sDˆ ‡fdd„ˆ¡IdH\}}ˆ ‡fdd„ˆ¡IdH\}}||fS)NcsˆSrrr©Ú read_protorrrÑGrkzSEventLoopTestsMixin.test_unclosed_pipe_transport..connect..csˆSrrr©Ú write_protorrrÑIrk)rÛÚconnect_write_pipe)Úread_transportr]Úwrite_transport©r'rëZrpipeobjZwpipeobjrírrrKEs ÿ ÿzAEventLoopTestsMixin.test_unclosed_pipe_transport..connectræ) r}rbrdrîrärårær&r1rDÚreprZ_pipe)r*rçrèrKrïrðrrñrÚtest_unclosed_pipe_transport9s   z0EventLoopTestsMixin.test_unclosed_pipe_transportcstˆjd‰t ¡\}}t |dd¡‰‡‡‡fdd„}ˆj |ƒ¡t |d¡t  ˆj‡fdd„¡ˆ  d ˆj ¡t |d ¡t  ˆj‡fd d„¡ˆ  d d gˆj ¡ˆ  dˆj ¡t  |¡ˆj  ¡ˆj ˆj¡ˆ  gd¢ˆj ¡ˆ ˆj d¡¡dS)NrirÙrc“s^ˆj ‡fdd„ˆ¡IdH\}}ˆ |ˆ¡ˆ |ˆj¡ˆ ddgˆj¡ˆ dˆj¡dS)NcsˆSrrrrSrrrÑdrkzKEventLoopTestsMixin.test_read_pty_output..connect..r8rBrrÚrÜ©Zmaster_read_objrTr*rrrKcsÿ z9EventLoopTestsMixin.test_read_pty_output..connectràcsˆjSrr„rrSrrrÑnrkz:EventLoopTestsMixin.test_read_pty_output..rnrács ˆjdkSrâr„rrSrrrÑrrkr8rBrrãrä)rbr'rîÚopenptyrårær&rUrrØržr;r:r1r9r>rr)r*ÚmasterÚslaverKrrôrÚtest_read_pty_output[s&       ÿz(EventLoopTestsMixin.test_read_pty_outputcs6t ¡\‰}t |dd¡}t|jd‰|j ‡fdd„|¡}|j |¡\}}| |ˆ¡| |ˆj ¡|  dˆj ¡|  d¡t ƒ‰‡fdd „‰t |j‡‡fd d„¡|  dˆ¡|  d ¡t |j‡‡fd d„¡|  d ˆ¡|  dˆj ¡t ˆ¡| ˆj  d¡¡ˆj  ¡|j ˆj¡|  dˆj ¡dS)NÚwbrÄricsˆSrrrrSrrrÑ…rkz5EventLoopTestsMixin.test_write_pipe..rBràcst ˆd¡}||7}t|ƒSrérîrßrI©rKÚchunk)rçrrrÎŽs z3EventLoopTestsMixin.test_write_pipe..readercs ˆˆƒdkSrârr©rKrÎrrrÑ“rkrács ˆˆƒdkSrârrrýrrrÑ—rkó12345rärP)rîrärårærdr'rîr&rr9ržr:rUrÖrrØr1rrr>)r*rèrßrKr9rÝr)rKrTrÎrçrÚtest_write_pipe~s,          z#EventLoopTestsMixin.test_write_pipecsÖt ¡\}}| d¡t | ¡dd¡}t|jd‰|j ‡fdd„|¡}|j  |¡\}}|  |ˆ¡|  |ˆj ¡|  dˆj ¡| d¡|j  |j |d¡¡}|  d|¡| ¡|j  ˆj¡|  d ˆj ¡dS) NFrùrÄricsˆSrrrrSrrrÑ­rkzIEventLoopTestsMixin.test_write_pipe_disconnect_on_close..rBràrP)rÓrÔrÕråræÚdetachrdr'rîr&rr9ržr:rUÚ sock_recvr1r>)r*ZrsockZwsockrßrKr9rÝrKrrSrÚ#test_write_pipe_disconnect_on_close¥s      z7EventLoopTestsMixin.test_write_pipe_disconnect_on_closerrÒcsBt ¡\‰}t |dd¡}t|jd‰|j ‡fdd„|¡}|j |¡\}}| |ˆ¡| |ˆj ¡|  dˆj ¡|  d¡t ƒ‰‡fdd „‰tj|j‡‡fd d„tjd |  dˆ¡|  d ¡tj|j‡‡fd d„tjd |  dˆ¡|  dˆj ¡t ˆ¡| ˆj  d¡¡ˆj  ¡|j ˆj¡|  dˆj ¡dS)NrùrricsˆSrrrrSrrrÑÆrkz4EventLoopTestsMixin.test_write_pty..rBràcst ˆd¡}||7}t|ƒSrÃrúrû©rörrrÎÏs z2EventLoopTestsMixin.test_write_pty..readercs ˆˆƒdkSrârrrýrrrÑÔrk©Útimeoutrács ˆˆƒdkSrârrrýrrrÑÙrkrþrärP)rîrõrårærdr'rîr&rr9ržr:rUrÖrrØr Ú SHORT_TIMEOUTr1rrr>)r*r÷Úslave_write_objrKr9rÝr)rKrörTrÎrÚtest_write_pty¼s4     ÿ  ÿ   z"EventLoopTestsMixin.test_write_ptyc sÂt ¡\‰}t |¡}t |¡t |dd¡}t|jd‰|j  ‡fdd„|¡}|j  |¡\}}|  |ˆ¡|  |ˆj ¡|  ddgˆj¡|  dˆj¡t |dd¡}t|jd‰|j ‡fd d„|¡}|j  |¡\} }|  |ˆ¡|  | ˆj ¡|  dˆj¡tƒ‰‡fd d „‰|  d ¡tj|j‡‡fd d„tjd|  d ˆ¡|  ddgˆj¡|  dˆj¡t ˆd¡tj|j‡fdd„tjd|  ddgˆj¡|  dˆj¡|  dˆj¡|  d¡tj|j‡‡fdd„tjd|  dˆ¡|  ddgˆj¡|  dˆj¡t ˆd¡tj|j‡fdd„tjd|  ddgˆj¡|  dˆj¡|  dˆj¡t ˆ¡| ¡|j  ˆj¡|  gd¢ˆj¡|  ¡|j  ˆj¡|  dˆj¡dS)NrÙrricsˆSrrrrêrrrÑôrkz.r8rBrùcsˆSrrrrìrrrÑÿrkcst ˆd¡}||7}t|ƒSrÃrúrûrrrrÎs z:EventLoopTestsMixin.test_bidirectional_pty..readerràcs ˆˆƒdkSrârrrýrrrÑ rkróacs ˆjdkSrâr„rrêrrrÑrkrnrács ˆˆƒdkSrârrrýrrrÑrkrþsbcdecs ˆjdkSrâr„rrêrrrÑ"rkrrãrP)rîrõÚdupÚttyZsetrawrårærbr'rÛr&rr9ržr:r;rdrîrÖrUrrØr rr1r>) r*Z read_slaveZ write_slaveZslave_read_objZ read_connectrïrÝrZ write_connectrðr)rKrörërÎrírÚtest_bidirectional_ptyèsz    ÿ  ÿ   ÿ  ÿ ÿ  ÿ  ÿz*EventLoopTestsMixin.test_bidirectional_ptycsæt ¡\}}| d¡ˆj ˆj |d¡¡‰tˆddƒ}|durLˆ |j¡‡‡fdd„}t   ¡}ˆj |ƒ¡}ˆj  ¡t   ¡|}ˆ  |d¡ˆ  | ¡d¡ˆ tjˆj¡|durƈ |j¡ˆj |¡| ¡| ¡dS)NFrnÚovc“sZzHzˆj ˆj¡ˆIdHWntjy6d}Yn0d}Wˆj ¡n ˆj ¡0|S)NÚ cancelled)r'r¢rÀrÚCancelledErrorr“)r¹©r?r*rrÚmain;s z:EventLoopTestsMixin.test_prompt_cancellation..mainrŽr)rÓrÔrÕr'rprÚgetattrr†ÚpendingrÚ monotonicrZ assertLessržÚresultr‹rrrÁryr1)r*rÍrÙr rr°r²ÚelapsedrrrÚtest_prompt_cancellation3s&          z,EventLoopTestsMixin.test_prompt_cancellationcsh‡‡fdd„}ˆjj‰dˆj_|ˆj_‡fdd„}ˆj |ƒ¡ˆ ˆjjdˆjjˆjjjjdœ¡dS)Ncsˆjjd7_ˆƒdSrâ)r'Ú_run_once_counterr©Z orig_run_oncer*rrÚ _run_onceWsz._run_oncerc“sZˆj}t d¡IdHt d¡IdHt d¡IdHt d¡IdHt d¡IdHdS)Nr÷g-Cëâ6?gíµ ÷ư>g:Œ0âŽyE>g»½×Ùß|Û=)r'rr„rir0rrÚwait_s z7EventLoopTestsMixin.test_timeout_rounding..waité)Zclock_resolutionÚselector) r'rrr&ZassertLessEqualZ_clock_resolutionÚ _selectorrWr3)r*rrrrrÚtest_timeout_roundingVs   ÿÿz)EventLoopTestsMixin.test_timeout_roundingcCsx| ¡}dd„}t ¡\}}| |j¡| |j¡| ||¡| ||¡| ¡| | |¡¡| |  |¡¡dS)NcSsdSrrrrrrrÑrrkzCEventLoopTestsMixin.test_remove_fds_after_closing..) r}rÓrÔrdr1r×rÝrÁrÈrÞ©r*r'r›rÍrÙrrrÚtest_remove_fds_after_closingps     z1EventLoopTestsMixin.test_remove_fds_after_closingcCs¬| ¡}dd„}t ¡\}}| |j¡| |j¡| ¡| t¡| ||¡Wdƒn1sh0Y| t¡| ||¡Wdƒn1sž0YdS)NcSsdSrrrrrrrÑ~rkz@EventLoopTestsMixin.test_add_fds_after_closing..) r}rÓrÔrdr1r‹rŒr×rÝr rrrÚtest_add_fds_after_closing|s    * z.EventLoopTestsMixin.test_add_fds_after_closingcsP‡fdd„}|ˆjƒ}ˆ t¡ˆj |¡Wdƒn1sB0YdS)Nc“sˆj ¡dSr)r'r1rir0rrÚ close_loop‰szEEventLoopTestsMixin.test_close_running_event_loop..close_loop)r'r‹rŒr&)r*r#rgrr0rÚtest_close_running_event_loopˆs   z1EventLoopTestsMixin.test_close_running_event_loopcCsJ|j ¡dd„}dd„}|ƒ}| |j¡| t¡|j ¡Wdƒn1sV0Y| t¡&|j ¡}|j |¡Wdƒn1s–0Y| t¡|j |¡Wdƒn1sÌ0Y| t¡|j  |¡Wdƒn1s0Y| t¡|j  d|¡Wdƒn1s>0Y| t¡(|j  |j  ¡d|¡Wdƒn1s‚0Y| t¡|j  |¡Wdƒn1sº0Y| t¡ |j tj|¡Wdƒn1sö0Y| t¡*|j d|¡ ¡}t|ƒWdƒn1s<0YdS)NcÓsdSrrrrrrÚtest“sz,EventLoopTestsMixin.test_close..testcSsdS©NFrrrrrrÑ–rkz0EventLoopTestsMixin.test_close..gð?g)r'r1rdr‹rŒrr<r&r¢r¦rœÚcall_atrrprèrëÚSIGTERMr·r2Únext)r*r%ÚfuncrgZfutÚitrrrÚ test_closes2   (  * * , . 8 , 0 zEventLoopTestsMixin.test_close)T)TN)TN)NN)N)N)N)Yr3r4r5r|r‚rr’r•r r£r³r´rºrÂrÚràraÚ skipUnlessr+rërôrürÿr rr Zskip_unless_bind_unix_socketrrr!r3ÚskipIfrr8r;r@rFr^rcrhrr,r|r~rr†rÓr‹r“r•r—ržrŸr r¤r¦r²r´r¸rºr»rÀrÂZ IPV6_ENABLEDrÆrÈrÑrÒrÓr×rØrrrérórørÿrr Úrequires_mac_verrr rrr!r"r$r,rYrrrVrr{ïsò       +    ÿ !þ ÿ %    6   $              (0   ÿ ÿ ÿ ! ÿ % ÿ  ÿ  ' ÿ  F#  r{c@sžeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z e   ejdkd¡dd„ƒZdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#S)$ÚSubprocessTestsMixincCs,tjdkr| |t¡n| tj |¡dS©Nr)rrrrržrër(©r*rsrrrÚcheck_terminated·s z%SubprocessTestsMixin.check_terminatedcCs,tjdkr| |t¡n| tj |¡dSr1)rrrrržrërár2rrrÚ check_killed¾s z!SubprocessTestsMixin.check_killedc Cs tj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡Î|j |¡\}}| |t ¡|j |j¡| d|j¡| d¡}| d¡|j |jd ¡¡t ¡| ¡Wdƒn1sÆ0Y|j |j¡| |j¡| d|jd¡Wdƒn1s0YdS)Núecho.pyrBróPython The Winnerrn)rîrŒr±ÚdirnameÚ__file__r'Úsubprocess_execr6r7rfrÚ executableÚ assertWarnsÚDeprecationWarningr&rr=ržr:Úget_pipe_transportrUrurrr.r1rpr4rsrK©r*ÚprogrKÚtransprTÚstdinrrrÚtest_subprocess_execÅs$ þ     & z)SubprocessTestsMixin.test_subprocess_execc Csdtj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡|j |¡\}}| |t ¡|j |j¡| d|j¡| d¡}| d¡|j |jd ¡¡|jd ¡| d|jd¡| d¡|j |jd ¡¡| d|jd¡t ¡| ¡Wdƒn1s0Y|j |j¡| |j¡Wdƒn1sV0YdS)Nr5rBrsPython rns The Winnerr6)rîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=ržr:r=rUrurÚclearrKrr.r1rpr4rsr>rrrÚtest_subprocess_interactiveÚs, þ     (z0SubprocessTestsMixin.test_subprocess_interactivecCsê| t¡Ì|j t t|j¡d¡}|j |¡\}}| |t¡|j |j ¡|  d¡  ¡|j |j ¡|  d|j¡| tdd„|j ¡Dƒƒ¡|  |jd d¡d¡|  |jdd ¡|  ¡Wdƒn1sÜ0YdS) Nz echo Pythonrcss|]}| ¡VqdSr)r>)rgr?rrrÚ rkz=SubprocessTestsMixin.test_subprocess_shell..rns sPythonrork)r;r<r'Úsubprocess_shellr6r7rfr&rr=r=r1rpržrsr†ÚallrrÚvaluesrKÚrstrip©r*rKr@rTrrrÚtest_subprocess_shellös  þ z*SubprocessTestsMixin.test_subprocess_shellcCsŽ|jjt t|j¡ddddd}| t¡ |j |¡\}}Wdƒn1sP0Y| |t¡|j |j ¡|  d|j ¡|  ¡dS)Núexit 7©rAÚstdoutÚstderré) r'rFr6r7rfr;r<r&rrpržrsr1rJrrrÚtest_subprocess_exitcodes þ . z-SubprocessTestsMixin.test_subprocess_exitcodecCsÄ|jjt t|j¡ddddd}| t¡ |j |¡\}}Wdƒn1sP0Y| |t¡|  |  d¡¡|  |  d¡¡|  |  d¡¡|j |j ¡|  d|j ¡|  | ¡¡dS)NrLrMrrnrorP)r'rFr6r7rfr;r<r&rr¯r=rpržrsr1rJrrrÚ"test_subprocess_close_after_finishs þ . z7SubprocessTestsMixin.test_subprocess_close_after_finishcCs´tj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡d|j |¡\}}| |t ¡|j |j¡| ¡|j |j¡| |j¡| ¡Wdƒn1s¦0YdS©Nr5)rîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=rïrpr4rsr1©r*r?rKr@rTrrrÚtest_subprocess_kill!s þ   z)SubprocessTestsMixin.test_subprocess_killcCs´tj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡d|j |¡\}}| |t ¡|j |j¡| ¡|j |j¡| |j¡| ¡Wdƒn1s¦0YdSrS)rîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=Ú terminaterpr3rsr1rTrrrÚtest_subprocess_terminate2s þ   z.SubprocessTestsMixin.test_subprocess_terminaterzDon't have SIGHUPc Csòt tjtj¡}zÌtj tj t¡d¡}|j  t   t |j¡t j|¡}| t¡n|j |¡\}}| |t ¡|j |j¡| tj¡|j |j¡| tj |j¡| ¡Wdƒn1sÂ0YWt tj|¡nt tj|¡0dSrS)rëÚSIGHUPÚSIG_DFLrîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=Ú send_signalrpržrsr1)r*Z old_handlerr?rKr@rTrrrÚtest_subprocess_send_signalCs  þ   (z0SubprocessTestsMixin.test_subprocess_send_signalcCsòtj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡¢|j |¡\}}| |t ¡|j |j¡| d¡}| d¡|j |j¡| ¡| d|jd¡| |jd d¡|jd¡| d|j¡Wdƒn1sä0YdS)Núecho2.pyrótestóOUT:testrnrosERR:test)rîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=r=rUrpr1ržrKr†rrsr>rrrÚtest_subprocess_stderr\s  þ    z+SubprocessTestsMixin.test_subprocess_stderrcCstj tj t¡d¡}|jjt t |j¡t j |t j d}| t¡Â|j |¡\}}| |t ¡|j |j¡| d¡}| | d¡¡| | d¡¡| d¡|j |j¡| |jd d¡|jd¡| d|jd¡| ¡| d|j¡Wdƒn1s 0YdS) Nr\)rOrrnror]sOUT:testERR:testrk)rîrŒr±r7r8r'r9r6r7rfrr:Ú subprocessÚSTDOUTr;r<r&rr=r=rr¯rUrpr†rKrržr1rsr>rrrÚ)test_subprocess_stderr_redirect_to_stdoutrs(  þ    ÿz>SubprocessTestsMixin.test_subprocess_stderr_redirect_to_stdoutc CsŒtj tj t¡d¡}|j t t |j¡t j |¡}|  t ¡8|j |¡\}}| |t ¡|j |j¡| d¡}| d¡}| d¡|j |jd ¡¡| d|jd¡| ¡|j |jd¡| d¡|j |jd ¡¡t jdkr | d |jd¡n| d |jd¡t ¡| ¡Wdƒn1sD0Y|j |j¡| |j¡Wdƒn1s~0YdS) Nzecho3.pyrrnr]r^rƒrorsERR:BrokenPipeErrors ERR:OSError)rîrŒr±r7r8r'r9r6r7rfrr:r;r<r&rr=r=rUrurržrKr1rrrrr.rpr4rs)r*r?rKr@rTrArNrrrÚ#test_subprocess_close_client_stream‹s2 þ       (z8SubprocessTestsMixin.test_subprocess_close_client_streamccs`|jjt t|j¡dddddd}|j |¡V\}}| |t¡|j |j¡| d|j ¡dS)NrLT)rArNrOÚstart_new_sessionrP) r'rFr6r7rfr&rrpržrs)r*rKr]rTrrrÚ"test_subprocess_wait_no_same_group­s ý z7SubprocessTestsMixin.test_subprocess_wait_no_same_groupcsćfdd„}ˆ t¡"ˆj |dd¡Wdƒn1s>0Yˆ t¡"ˆj |dd¡Wdƒn1sz0Yˆ t¡"ˆj |dd¡Wdƒn1s¶0YdS)Nc›s"ˆjjtjdfi|¤ŽIdHdS©NÚpwd)r'r9rÚSubprocessProtocol)rqr0rrrK¹s þþzGSubprocessTestsMixin.test_subprocess_exec_invalid_args..connectT©Úuniversal_newlinesé©Úbufsize©Úshell©r‹rêr'r&©r*rKrr0rÚ!test_subprocess_exec_invalid_args¸s  0 0 z6SubprocessTestsMixin.test_subprocess_exec_invalid_argscsd ‡fdd„ }ˆ t¡$ˆj |ddgƒ¡Wdƒn1sB0Yˆ t¡"ˆj |dd¡Wdƒn1s~0Yˆ t¡"ˆj |dd¡Wdƒn1sº0Yˆ t¡"ˆj |d d ¡Wdƒn1sö0YdS) Nc›s*|sd}ˆjjtj|fi|¤ŽIdHdSrf)r'rFrrh)Úcmdrqr0rrrKÇsþþzHSubprocessTestsMixin.test_subprocess_shell_invalid_args..connectZlsz-lTrirkrlFrn)Nrprqrr0rÚ"test_subprocess_shell_invalid_argsÅs 2 0 0 z7SubprocessTestsMixin.test_subprocess_shell_invalid_argsN)r3r4r5r3r4rBrDrKrQrRrUrWrar.rrr[r_rbrcrerrrtrrrrr0µs"  "  r0c@seZdZdd„ZdS)ÚSelectEventLoopTestscCst ¡Sr)rÚSelectorEventLoopr0rrrr}Ýsú&SelectEventLoopTests.create_event_loopN©r3r4r5r}rrrrruÚsruc@s<eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S)ÚProactorEventLoopTestscCst ¡Sr)rZProactorEventLoopr0rrrr}äsz(ProactorEventLoopTests.create_event_loopcCst d¡‚dS©Nz(IocpEventLoop does not have add_reader()©rarbr0rrrrÚçsz+ProactorEventLoopTests.test_reader_callbackcCst d¡‚dSrzr{r0rrrÚtest_reader_callback_cancelêsz2ProactorEventLoopTests.test_reader_callback_cancelcCst d¡‚dS©Nz(IocpEventLoop does not have add_writer()r{r0rrrràísz+ProactorEventLoopTests.test_writer_callbackcCst d¡‚dSr}r{r0rrrÚtest_writer_callback_cancelðsz2ProactorEventLoopTests.test_writer_callback_cancelcCst d¡‚dSrzr{r0rrrr!ósz4ProactorEventLoopTests.test_remove_fds_after_closingN) r3r4r5r}rÚr|ràr~r!rrrrryàs rycs(eZdZ‡fdd„Z‡fdd„Z‡ZS)ÚUnixEventLoopTestsMixincs,tƒ ¡t ¡}| |j¡t |¡dSr)rTr|rÚSafeChildWatcherÚ attach_loopr'Úset_child_watcher©r*ZwatcherrVrrr|ùs  zUnixEventLoopTestsMixin.setUpcst d¡tƒ ¡dSr)rr‚rTr‚r0rVrrr‚ÿs z UnixEventLoopTestsMixin.tearDown)r3r4r5r|r‚rYrrrVrrøs rÚKqueueSelectorcs\eZdZdd„Ze dd¡e ej   d¡d¡‡fdd„ƒƒZ e dd¡‡fd d „ƒZ ‡Z S) ÚKqueueEventLoopTestscCst t ¡¡Sr)rrvÚ selectorsr„r0rrrr} sÿz&KqueueEventLoopTests.create_event_loopré Zopenbsdztest hangs on OpenBSDcstƒ ¡dSr)rTrør0rVrrrøsz)KqueueEventLoopTests.test_read_pty_outputcstƒ ¡dSr)rTrr0rVrrrsz#KqueueEventLoopTests.test_write_pty)r3r4r5r}r r/rar.rrrrørrYrrrVrr…s ÿ r…Ú EpollSelectorc@seZdZdd„ZdS)ÚEPollEventLoopTestscCst t ¡¡Sr)rrvr†rˆr0rrrr}"sz%EPollEventLoopTests.create_event_loopNrxrrrrr‰sr‰Ú PollSelectorc@seZdZdd„ZdS)ÚPollEventLoopTestscCst t ¡¡Sr)rrvr†rŠr0rrrr}*sz$PollEventLoopTests.create_event_loopNrxrrrrr‹&sr‹c@seZdZdd„ZdS)rucCst t ¡¡Sr)rrvr†ÚSelectSelectorr0rrrr}2srwNrxrrrrru.scOsdSrr)r½r’rrrÚnoop6srcsheZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z e   e e jdƒd¡dd„ƒZ‡ZS)Ú HandleTestscs"tƒ ¡t ¡|_d|jj_dSr»)rTr|rrxr'Ú get_debugÚ return_valuer0rVrrr|<s  zHandleTests.setUpcCs`dd„}d}t |||j¡}| |j|¡| |j|¡| | ¡¡| ¡|  | ¡¡dS)NcWs|Srrr¼rrrr›Bsz)HandleTests.test_handle..callbackr) rÚHandler'rÚ _callbackÚ_argsrÁrrÀr†)r*r›r½ÚhrrrÚ test_handleAszHandleTests.test_handlecCs\dd„}t ¡|_t ¡|j_t |d|j¡}| ¡|jj t  d¡tj ||j dœ¡dS)NcSs tƒ‚dSr)rêrrrrr›Osz:HandleTests.test_callback_with_exception..callbackrzException in callback.*)rPr/ÚhandleZsource_traceback) rrxr'r¨rr‘Z_runÚassert_called_withrZ MockPatternÚANYÚ_source_traceback)r*r›r”rrrÚtest_callback_with_exceptionNs  üz(HandleTests.test_callback_with_exceptioncCs(t ¡}t dd„d|j¡}||d<dS)NcSsdSrrrrrrrÑarkz1HandleTests.test_handle_weakref..rr”)ÚweakrefÚWeakValueDictionaryrr‘r')r*Zwdr”rrrÚtest_handle_weakref_szHandleTests.test_handle_weakrefcCs¢d|jj_t td|j¡}t t¡\}}| t |ƒd||f¡|  ¡| t |ƒd¡|  t ¡t  t¡}Wdƒn1s‚0Yt |d|j¡}| t |ƒd||f¡t tdd¡}t |d |j¡}d t |¡|f}| t |ƒ|¡tjtdd }t |d |j¡}d t |¡|f}| t |ƒ|¡tjdkržtj}t |¡}t |¡\}}t |d|j¡}d}d|}d|t |¡|f}| t |ƒ|¡dS)NFrmzzrzrnro)rlz%^$)Úx)rorlz'^$)rléz*z%functools.partialmethod\(%s, , \)\(\)z^$)r'rrrr‘rrÚget_function_sourceržròrÀr;r<Ú coroutiner6r7ÚreÚescapeZ assertRegexrr_rŽÚtest_handle_reprÚ partialmethod)r*r”ÚfilenameÚlinenor”ZregexÚmethodZcb_regexrrrr¤dsV  ÿÿ ÿ ( ÿÿ ÿ ÿ  ÿzHandleTests.test_handle_reprcCs¢d|jj_t}t ¡jd}t t d|j¡}t   t ¡\}}|  t |ƒd||||f¡| ¡|  t |ƒd||||f¡| ¡|  t |ƒd||||f¡dS)NTrnrmz-z7)r'rrr8rÚ _getframeÚf_linenorr‘rrr ržròrÀ©r*Zcreate_filenameZ create_linenor”r¦r§rrrÚtest_handle_repr_debug–s0   ÿÿ ÿþ ÿþz"HandleTests.test_handle_repr_debugcs|t ¡ ¡}| d¡ˆ |¡‡fdd„}| t¡}||ƒ| t¡}||ƒ| dt¡}||ƒ| dt¡}||ƒdS)NTcsBt d¡jd}ˆ |jt¡ˆ |jddd…t|df¡dS)NrnrærlÚtest_handle_source_traceback)rr©rªrr™Úlistržr8)r”r§r0rrÚcheck_source_tracebackµsþÿzHHandleTests.test_handle_source_traceback..check_source_tracebackr) rÚget_event_loop_policyr$Ú set_debugr%r¢rr¦rœ)r*r'r¯r”rr0rr­°s       z(HandleTests.test_handle_source_tracebackÚ CoroutinezNo collections.abc.CoroutinecCsÂtƒ}d|_| t |¡¡| t |¡d¡d|_| t |¡d¡d|_ | t |¡d¡d|_|_| t |¡d¡tƒ}d|_| t |¡d ¡tƒ}d|_d|_ | t |¡d¡dS) NZAAAzAAA()ZBBBzBBB()Tz BBB() runningz%() runningr)z CoroLike()) r)r3r†rZ iscoroutineržrZ_format_coroutiner5Ú cr_runningÚcr_code)r*rgrrrÚ+test_coroutine_like_object_debug_formattingÍs&  ÿz7HandleTests.test_coroutine_like_object_debug_formatting)r3r4r5r|r•ršrr¤r¬r­rar-r+Ú collectionsÚabcrµrYrrrVrrŽ:s  2ÿrŽcsLeZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z ‡Z S)Ú TimerTestscstƒ ¡t ¡|_dSr)rTr|rrxr'r0rVrrr|ñs zTimerTests.setUpcCs8t ¡}t |dd„dt ¡¡}| t|ƒt|ƒ¡dS)NcSsdSr&rrrrrrÑ÷rkz&TimerTests.test_hash..r)rrrÚ TimerHandlerrxržÚhash©r*Úwhenr”rrrÚ test_hashõs ÿzTimerTests.test_hashcCs4t ¡}t |dd„dt ¡¡}| || ¡¡dS)NcSsdSr&rrrrrrÑýrkz&TimerTests.test_when..r)rrrr¹rrxržr¼r»rrrÚ test_whenûs ÿzTimerTests.test_whencCsœdd„}d}t ¡}t |||t ¡¡}| |j|¡| |j|¡|  |  ¡¡|  ¡|  |  ¡¡|  |j¡|  |j¡| ttjd|||j¡dS)NcWs|Srrr¼rrrr› sz'TimerTests.test_timer..callback)rnrorl)rrrr¹rrxrr’r“rÁrrÀr†r¯r‹ÚAssertionErrorr')r*r›r½r¼r”rrrÚ test_timer s   þzTimerTests.test_timercCsVd|jj_t dtd|j¡}t t¡}| t |ƒd|¡|  ¡| t |ƒd¡dS)NFé{rz&z ) r'rrrr¹rrr ržròrÀ)r*r”ÚsrcrrrÚtest_timer_repr s   ÿ ÿzTimerTests.test_timer_reprcCs€d|jj_t}t ¡jd}t dt d|j¡}t   t ¡\}}|  t |ƒd||||f¡| ¡|  t |ƒd||||f¡dS)NTrnrÁrz7zA)r'rrr8rr©rªrr¹rrr ržròrÀr«rrrÚtest_timer_repr_debug% s    þÿ  þÿz TimerTests.test_timer_repr_debugcCs:dd„}t ¡}t ||d|j¡}t ||d|j¡}| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ¡| ||k¡t ||d|j¡}t |d|d|j¡}| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡| ||k¡t |d|j¡}|  t |  |¡¡|  t |  |¡¡|  t¡|dkWdƒn1sè0Y|  t¡|dkWdƒn1s0Y|  t¡|dkWdƒn1sP0Y|  t¡|dkWdƒn1s„0Y| |dk¡| |dk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡| |tk¡dS)NcWs|Srrr¼rrrr›; sz2TimerTests.test_timer_comparison..callbackrg$@)rrrr¹r'rÁr†rÀr‘rÚNotImplementedÚ__eq__Ú__ne__r‹rçr r r )r*r›r¼Zh1Zh2Zh3rrrÚtest_timer_comparison: sf ( ( ( (z TimerTests.test_timer_comparison) r3r4r5r|r½r¾rÀrÃrÄrÈrYrrrVrr¸ïs r¸c@seZdZdd„Zdd„ZdS)ÚAbstractEventLoopTestscCs t ¡}t ¡}| t|j¡| t|jd¡| t|j¡| t|j ¡| t|j ¡| t|j ¡| t|j d¡| t|j dd¡| t|j||¡| t|jd¡| t|j¡| t|jd¡| t|j|¡| t|jd|¡| t|jd¡| t|jd|¡| t|jd¡| t|jd|¡| t|jd¡| t|jd¡| t|j|¡| t|j|¡| t|j|¡| t|j¡| t|j|¡dSrâ)rrxrÚAbstractEventLoopr‹ÚNotImplementedErrorrr&r“r‡r~r1rprœr'r¢rr¦Zset_default_executorr×rÈrÝrÞrèréZset_exception_handlerZdefault_exception_handlerr¨rr±)r*r?r'rrrÚtest_not_implemented{ sšÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿ ÿÿ ÿÿ ÿÿÿÿÿÿÿÿz+AbstractEventLoopTests.test_not_implementedcs,‡fdd„}t ¡}| |ƒ¡| ¡dS)Nc“s(t ¡}t ¡}ˆ t¡"| ||¡IdHWdƒn1sB0Yˆ t¡"| dd¡IdHWdƒn1s~0Yˆ t¡ | d¡IdHWdƒn1s¸0Yˆ t¡ |  |¡IdHWdƒn1sò0Yˆ t¡ |  |¡IdHWdƒn1s.0Yˆ t¡ |  |¡IdHWdƒn1sj0Yˆ t¡"|  |d¡IdHWdƒn1s¨0Yˆ t¡"|  |d¡IdHWdƒn1sæ0Yˆ t¡"| |d¡IdHWdƒn1s$0Yˆ t¡"| ||¡IdHWdƒn1sb0Yˆ t¡ | |¡IdHWdƒn1sž0Yˆ t¡"| ||¡IdHWdƒn1sÜ0Yˆ t¡"| ||¡IdHWdƒn1s0Yˆ t¡&| |tjj¡IdHWdƒn1s\0Yˆ t¡&| |tjj¡IdHWdƒn1sž0Yˆ t¡$| |tj¡IdHWdƒn1sÞ0Yˆ t¡ | |¡IdHWdƒn1s0YdS)Nr¹é)r¹rÍr)rrxrrÊr‹rËr·rorÎrrUrÍrZsock_recv_intoZ sock_sendallZ sock_connectZ sock_acceptZ sock_sendfileÚsendfilerÛÚsentinelrärîrFr9)r?r'r0rrÚinner³ sH 0 0 . . 0 0 2 2 2 2 0 2 2 6 6 4 z@AbstractEventLoopTests.test_not_implemented_async..inner)rr$r&r1)r*rÐr'rr0rÚtest_not_implemented_async± s ' z1AbstractEventLoopTests.test_not_implemented_asyncN)r3r4r5rÌrÑrrrrrÉy s6rÉc@s^eZdZdd„Zdd„Zdd„Zdd„Ze d ¡d d „ƒZ d d „Z dd„Z dd„Z dd„Z dS)Ú PolicyTestscCsZt ¡}| t|j¡| t|jtƒ¡| t|j¡| t|j¡| t|j tƒ¡dSr) rÚAbstractEventLoopPolicyr‹rËÚget_event_loopr%r®r$Zget_child_watcherr‚©r*ÚpolicyrrrÚtest_event_loop_policyá s ÿz"PolicyTests.test_event_loop_policycCsXt ¡}| |jj¡| ¡}| |tj¡| |jj|¡| || ¡¡|  ¡dSr) rÚDefaultEventLoopPolicyr¯Ú_localZ_looprÔrrÊrr1©r*rÖr'rrrÚtest_get_event_loopê szPolicyTests.test_get_event_loopcCsZt ¡}tjj|d|jd"}| ¡}| |¡Wdƒn1sD0Y| ¡dS)Nr%)Úwraps) rrØrr,r®r%rÔr—r1)r*rÖZm_set_event_loopr'rrrÚ(test_get_event_loop_calls_set_event_loopõ sþ(z4PolicyTests.test_get_event_loop_calls_set_event_loopcCs$t ¡}| d¡| t|j¡dSr)rrØr%r‹rŒrÔrÕrrrÚ"test_get_event_loop_after_set_none s z.PolicyTests.test_get_event_loop_after_set_nonez'asyncio.events.threading.current_threadcs,‡fdd„}tj|d}| ¡| ¡dS)Ncst ¡}ˆ t|j¡dSr)rrØr‹rŒrÔ)rÖr0rrr? sz1PolicyTests.test_get_event_loop_thread..frª)r¬r¯r°r±)r*Zm_current_threadr?Úthrr0rÚtest_get_event_loop_thread s  z&PolicyTests.test_get_event_loop_threadcCs*t ¡}| ¡}| |tj¡| ¡dSr)rrØr$rrÊr1rÚrrrÚtest_new_event_loop szPolicyTests.test_new_event_loopcCsht ¡}| ¡}| t|jtƒ¡| ¡}| |¡| || ¡¡|  || ¡¡|  ¡|  ¡dSr) rrØrÔr‹r¿r%r®r$rÚ assertIsNotr1)r*rÖZold_loopr'rrrÚtest_set_event_loop s zPolicyTests.test_set_event_loopcCs*t ¡}| |tj¡| |t ¡¡dSr)rr°rrÓrrÕrrrÚtest_get_event_loop_policy) sz&PolicyTests.test_get_event_loop_policycCsL| ttjtƒ¡t ¡}t ¡}t |¡| |t ¡¡| ||¡dSr) r‹r¿rrr®r°rØrrâ)r*Ú old_policyrÖrrrÚtest_set_event_loop_policy. s ÿ z&PolicyTests.test_set_event_loop_policyN)r3r4r5r×rÛrÝrÞrr,ràrárãrärærrrrrÒß s    rÒcsReZdZdZdZdZdZ‡fdd„Z‡fdd„Ze j dkrBdd„Z d d „Z ‡Z S) ÚGetEventLoopTestsMixinNcsÌtj|_tj|_tj|_tj|_t |ƒj t_t |ƒj t_t |ƒj t_t |ƒj t_t |ƒj t_t |ƒj t_t |ƒj t_t |ƒj t_tƒ ¡t ¡|_t |j¡tjdkrÈt ¡}| |j¡t |¡dSr1)rÚ_get_running_loopÚ_get_running_loop_savedÚ_set_running_loopÚ_set_running_loop_savedÚget_running_loopÚget_running_loop_savedrÔÚget_event_loop_savedrÔÚ_get_running_loop_implÚ_set_running_loop_implÚget_running_loop_implÚget_event_loop_implrrTr|r$r'r%rrr€rr‚rƒrVrrr|A s&             zGetEventLoopTestsMixin.setUpc sÒzvtjdkrt d¡tƒ ¡W|j ¡t d¡|j t _ |j t _ |jt _|jt _|j t_ |j t_ |jt_|jt_nV|j ¡t d¡|j t _ |j t _ |jt _|jt _|j t_ |j t_ |jt_|jt_0dSr1)rrrr‚rTr‚r'r1r%rérrèrërêrírìrîrÔr0rVrrr‚[ s0      õ  zGetEventLoopTestsMixin.tearDownrcs.t ¡‡fdd„}ˆ ˆj |ƒ¡d¡dS)Nc“s*tj ¡}ˆj |t¡IdH}| ¡|Sr)Ú concurrentÚfuturesÚProcessPoolExecutorr'r·r(Úshutdown)Úpoolrr0rrrw s  ÿ zDGetEventLoopTestsMixin.test_get_event_loop_new_process..mainr")r Z*skip_if_broken_multiprocessing_synchronizeržr'r&)r*rrr0rÚtest_get_event_loop_new_processq s   þz6GetEventLoopTestsMixin.test_get_event_loop_new_processc s&Gdd„dtƒ‰G‡fdd„dtjƒ}t ¡}z„t |ƒ¡t ¡‰ˆ ˆ¡t ¡Wdƒn1sn0Yt d¡ˆ ˆ¡t ¡Wdƒn1sª0Yˆ  t d¡ ˆ  t  ¡d¡Wdƒn1sæ0Yˆ  t  ¡d¡‡‡fdd„}ˆ |ƒ¡t ˆ¡ˆ ˆ¡t ¡Wdƒn1sN0Yt d¡ˆ ˆ¡t ¡Wdƒn1sŒ0YWt |¡ˆdurÔˆ ¡nt |¡ˆdurÒˆ ¡0ˆ  t d¡ ˆ  t  ¡d¡Wdƒn1s0Yˆ  t  ¡d¡dS)Nc@s eZdZdS)zRGetEventLoopTestsMixin.test_get_event_loop_returns_running_loop..TestErrorN)r3r4r5rrrrÚ TestErrorƒ srùcseZdZ‡fdd„ZdS)zOGetEventLoopTestsMixin.test_get_event_loop_returns_running_loop..Policycsˆ‚dSrrr0©rùrrrÔ‡ sz^GetEventLoopTestsMixin.test_get_event_loop_returns_running_loop..Policy.get_event_loopN)r3r4r5rÔrrúrrÚPolicy† srûz no runningc“s4ˆ t ¡ˆ¡ˆ t ¡ˆ¡ˆ t ¡ˆ¡dSr)rrrÔrìrèr)r'r*rrr*™ szMGetEventLoopTestsMixin.test_get_event_loop_returns_running_loop..func)rMrrØr°rr$r‹rÔr%rerŒrrìrèr&r1)r*rûrår*r)rùr'r*rÚ(test_get_event_loop_returns_running_loop‚ s>  &  &.   (  *   þ   0z?GetEventLoopTestsMixin.test_get_event_loop_returns_running_loop)r3r4r5rïrðrñròr|r‚rrrørürYrrrVrrç: s   rçc@s$eZdZejZejZejZ ej Z dS)ÚTestPyGetEventLoopN) r3r4r5rZ_py__get_running_looprïZ_py__set_running_looprðZ_py_get_running_looprñZ_py_get_event_loopròrrrrrý³ srýc@s$eZdZejZejZejZ ej Z dS)ÚTestCGetEventLoopN) r3r4r5rZ_c__get_running_looprïZ_c__set_running_looprðZ_c_get_running_looprñZ_c_get_event_loopròrrrrrþÁ srþc@seZdZdd„ZdS)Ú TestServercsbt ¡}| |j¡t|ƒ‰| | ‡fdd„dd¡¡}| | ¡|¡| ¡| |  ¡¡dS)NcsˆSrrrrSrrrÑÏ rkz*TestServer.test_get_loop..r‚r) rr$rdr1rSr&rUržÚget_loopÚ wait_closed)r*r'r{rrSrÚ test_get_loopË s zTestServer.test_get_loopN)r3r4r5rrrrrrÿÉ srÿc@s$eZdZdd„Zdd„Zdd„ZdS)ÚTestAbstractServercCs:| t¡t ¡ ¡Wdƒn1s,0YdSr)r‹rËrÚAbstractServerr1r0rrrr,× s zTestAbstractServer.test_closecCsTt ¡}| |j¡| t¡"| t ¡  ¡¡Wdƒn1sF0YdSr) rr$rdr1r‹rËr&rrrr?rrrÚtest_wait_closedÛ s  z#TestAbstractServer.test_wait_closedcCs:| t¡t ¡ ¡Wdƒn1s,0YdSr)r‹rËrrrr0rrrrâ s z TestAbstractServer.test_get_loopN)r3r4r5r,rrrrrrrÕ srÚ__main__)LÚ__doc__Úcollections.abcr¶Úconcurrent.futuresrór6rårîrr¢rërÓrÚ ImportErrorr`rr¬rrBrarr›r rrrrrZtest.test_asynciorrr%r Z test.supportr r r r rr r(r)rr6rSZDatagramProtocolrZrbZ BaseProtocolrdrhrfr{r0ZTestCaseruryr†rr+r…r‰r‹rrŽr¸rÉrÒrçrýZ_asynciorþrÿrr3rrrrrÚsÐ              " )Q%  ÿ þ  þ  þ  þ þ6 f[y