+
    BiM                       R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RI
Ht ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ RIt]P4                  t ! R
 R]4      tR tR tR t  ! R R]PB                  4      t" ! R R]PB                  4      t# ! R R]PH                  4      t% ! R R]PL                  4      t' ! R R]PB                  4      t( ! R R]
PB                  4      t) ! R R]PB                  4      t* ! R R]PB                  4      t+],R8X  d   ]
PZ                  ! 4        R# R# ) zTests for base_events.pyN)mock)base_events)	constants)utils)support)assert_python_ok)	os_helper)socket_helperc                       ] tR t^tRtR# )CustomError N__name__
__module____qualname____firstlineno____static_attributes__r       9/usr/lib/python3.14/test/test_asyncio/test_base_events.pyr   r      s    r   r   c                  D    \         P                  P                  R 4       R # N)asyncioevents_set_event_loop_policyr   r   r   tearDownModuler      s    NN))$/r   c            	      D   \         P                  ! \        R 7      p R F@  p\        \        V4      '       d   \	        W\        \        V4      4       K5  \        W4       KB  	  \         P                  ! 4       V n        \        P                  ! 4       V P                  n	        V # ))spec)
AF_INETAF_INET6	AF_UNSPECIPPROTO_TCPIPPROTO_UDPSOCK_STREAM
SOCK_DGRAM
SOL_SOCKETSO_REUSEADDR	inet_pton)
r   	MagicMocksockethasattrsetattrgetattrdelattr
test_utilsmock_nonblocking_socketreturn_value)m_socketnames     r   mock_socket_moduler2   #   sn    ~~6*H 64  HGFD$9:H# nn&HO#-#E#E#GHOO Or   c                 F    \         P                  ! R \        R7      ! V 4      # )zasyncio.base_events.socket)new_callable)r   patchr2   )fs   &r   patch_socketr7   4   s!    ::2#5778: :r   c                   <   a  ] tR t^9t o R tR t]R 4       tRtV t	R# )BaseEventTestsc           
     (   \         P                  p\         P                  p\         P                  p\         P                  p\         P
                  p\         P                  p\         P                  pV P                  W$VR R3\        P                  ! R^W$V4      4       V P                  W$VR R3\        P                  ! R^W$V4      4       V P                  W$VR R3\        P                  ! R^WV4      4       V P                  W%VR R3\        P                  ! R^WV4      4       V P                  W$VR R3\        P                  ! R^W^ 4      4       V P                  W%VR R3\        P                  ! R^W^ 4      4       V P                  \        P                  ! R^V^ ^ 4      4       \        P                  '       d   V P                  \        P                  ! R^W4V4      4       V P                  W4VR R3\        P                  ! R^W4V4      4       V P                  W4VR R3\        P                  ! R^WV4      4       V P                  \        P                  ! R^W$V4      4       V P                  \        P                  ! R^W4V4      4       R# R# ) 1.2.3.4s   1.2.3.4::3z::3%lo0Nr<      )r=   r?       r@   )r(   r   r   r   r"   r#   r    r!   assertEqualr   _ipaddr_infoassertIsNoner	   IPV6_ENABLED)selfUNSPECINETINET6STREAMDGRAMTCPUDPs   &       r   test_ipaddr_infoBaseEventTests.test_ipaddr_info;   sz   !!~~##!!    3N3$$Y4E	G 	3N3$$ZD#F	H 	3N3$$Y63G	I 	#r>2$$Y6#F	H
 	3N3$$Y61E	G
 	#r>2$$Y6!D	F
 	$$Y61a@	B %%%((AucJL R)9:((5#FH R)9:((63GI
 ((4EG ((AucJL% &r   c           
     (   \         P                  p\         P                  p\         P                  pV P	                  WVR R3\
        P                  ! RRWV4      4       V P	                  WVR R3\
        P                  ! RRWV4      4       V P	                  WVR R3\
        P                  ! RR WV4      4       V P	                  WVR R3\
        P                  ! RRWV4      4       V P	                  WVR R3\
        P                  ! RRWV4      4       R# )r;   r<   Nr   1   1r<   r@   r>   )r(   r   r"   r    rA   r   rB   )rE   rG   rI   rK   s   &   r   test_port_parameter_types(BaseEventTests.test_port_parameter_typesw   s   ~~##  3N3$$YdCH	J 	3N3$$YT3G	I 	3N3$$YD#F	H 	3N3$$YT3G	I 	3N3$$YdCH	Jr   c           	         V= V P                  \        P                  ! R ^\        P
                  \        P                  \        P                  4      4       R# )r<   N)r&   rC   r   rB   r(   r   r"   r    rE   r0   s   &&r   test_ipaddr_info_no_inet_pton,BaseEventTests.test_ipaddr_info_no_inet_pton   sB    +229a39>>393E3E393E3EG 	Hr   r   N)
r   r   r   r   rM   rS   r7   rW   r   __classdictcell____classdict__s   @r   r9   r9   9   s(     :LxJ4 H Hr   r9   c                   @  a a ] tR t^t oV 3R ltR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R% t(R& t)R' t*R( t+R) t,R* t-R+ t.R, t/R- t0R. t1R/t2Vt3V ;t4# )0BaseEventLoopTestsc                   < \         SV `  4        \        P                  ! 4       V n        \
        P                  ! 4       V P                  n        RV P                  P                  P                  n	        V P                  V P                  4       R # Nr   )supersetUpr   BaseEventLooploopr   Mock	_selectorselectr/   set_event_looprE   	__class__s   &r   ra   BaseEventLoopTests.setUp   sX    --/	"iik		24		""/DII&r   c           	     \   \         P                  ! 4       pV P                  \        V P                  P
                  W4       V P                  \        V P                  P                  WW4       V P                  \        V P                  P                  W4       V P                  \        V P                  P                  . 4       V P                  \        V P                  P                  4       V P                  \        V P                  P                  W4       V P                  \        V P                  P                  W4       V P                  P                  WWWV4      pV P                  \        4      ;_uu_ 4        VP                  R 4       R R R 4       R #   + '       g   i     R # ; ir   )r   rd   assertRaisesNotImplementedErrorrc   _make_socket_transport_make_ssl_transport_make_datagram_transport_process_events_write_to_self_make_read_pipe_transport_make_write_pipe_transport_make_subprocess_transportsend)rE   mgens   &  r   test_not_implemented'BaseEventLoopTests.test_not_implemented   s<   IIKII,,a	4 	II))1	7 	II..	6 	!:!:B	@!9!9	;II//	7 	II00!	8 ii221qQG233HHTN 4333s   >FF+	c                $   V P                  V P                  P                  4       4       V P                  P                  4        V P	                  V P                  P                  4       4       V P                  P                  4        V P                  P                  4        V P                  P                  4       pV P                  \        V P                  P                  4       V P                  \        V P                  P                  V4       R # r   )
assertFalserc   	is_closedclose
assertTruecreate_futurerl   RuntimeErrorrun_foreverrun_until_complete)rE   r6   s   & r   
test_closeBaseEventLoopTests.test_close   s    ,,./				++-. 					 II##%,		(=(=>,		(D(DaHr   c                   \         P                  ! R  RV P                  R4      pV P                  P                  V4       V P	                  V P                  P
                  4       V P                  WP                  P                  4       R# )c                      R # Fr   r   r   r   <lambda>>BaseEventLoopTests.test__add_callback_handle.<locals>.<lambda>       5r   Nr   )r   Handlerc   _add_callbackr|   
_scheduledassertIn_readyrE   hs   & r   test__add_callback_handle,BaseEventLoopTests.test__add_callback_handle   sZ    NN="dii>		"--.a))*r   c                8   \         P                  ! R  RV P                  R4      pVP                  4        V P                  P	                  V4       V P                  V P                  P                  4       V P                  V P                  P                  4       R# )c                      R # r   r   r   r   r   r   HBaseEventLoopTests.test__add_callback_cancelled_handle.<locals>.<lambda>   r   r   Nr   )r   r   rc   cancelr   r|   r   r   r   s   & r   #test__add_callback_cancelled_handle6BaseEventLoopTests.test__add_callback_cancelled_handle   se    NN="dii>	
		"--.))*r   c                j    ! R  R\         P                  P                  4      p\        P                  ! 4       V P
                  n        \        P                  ! 4       V P
                  n        V! 4       pV P
                  P                  V4       V P                  W P
                  P                  4       R# )c                   &   a  ] tR t^t o R tRtV tR# )CBaseEventLoopTests.test_set_default_executor.<locals>.DummyExecutorc                    \        R 4      h)z#cannot submit into a dummy executor)rm   )rE   fnargskwargss   &&*,r   submitJBaseEventLoopTests.test_set_default_executor.<locals>.DummyExecutor.submit   s    )9; ;r   r   N)r   r   r   r   r   r   rY   rZ   s   @r   DummyExecutorr      s     ; ;r   r   N)
concurrentfuturesThreadPoolExecutorr   rd   rc   rq   rr   set_default_executorassertIs_default_executor)rE   r   executors   &  r   test_set_default_executor,BaseEventLoopTests.test_set_default_executor   so    	;J..AA 	;
 %)IIK		!#'99;		  ?		&&x0h		 ; ;<r   c                (   \         P                  ! 4       pR pV P                  \        V4      ;_uu_ 4        V P                  P                  V4       RRR4       V P                  V P                  P                  4       R#   + '       g   i     L7; i)z,executor must be ThreadPoolExecutor instanceN)r   rd   assertRaisesRegex	TypeErrorrc   r   rC   r   )rE   r   msgs   &  r   test_set_default_executor_error2BaseEventLoopTests.test_set_default_executor_error   s_    99;<##Is33II**84 4 	$))556 43s   BB	c                |  a \         P                  ! 4       o ! V3R  lR\        P                  P                  4      p\
        P                  ! 4       V P                  n        \
        P                  ! 4       V P                  n	        V! 4       pV P                  P                  V4        V P                  \        R4      ;_uu_ 4        V P                  P                  V P                  P                  RR7      4       RRR4       SP                  4        R#   + '       g   i     L"; i  SP                  4        i ; i)c                   :   <a  ] tR t^t o RRR/V3R llltRtV tR# )PBaseEventLoopTests.test_shutdown_default_executor_timeout.<locals>.DummyExecutorcancel_futuresFc               <   < V'       d   SP                  4        R # R # r   )wait)rE   r   r   events   &&$r   shutdownYBaseEventLoopTests.test_shutdown_default_executor_timeout.<locals>.DummyExecutor.shutdown   s    JJL r   r   NT)r   r   r   r   r   r   rY   )r[   r   s   @r   r   r      s     !E ! !r   r   z&The executor did not finishing joining{Gz?)timeoutN)	threadingEventr   r   r   r   rd   rc   rq   rr   r   assertWarnsRegexRuntimeWarningr   shutdown_default_executorset)rE   r   r   r   s   &  @r   &test_shutdown_default_executor_timeout9BaseEventLoopTests.test_shutdown_default_executor_timeout   s    !	!J..AA 	!
 %)IIK		!#'99;		  ?		&&x0	&&~'OQ Q		,,II777EGQ
 IIKQ Q
 IIKs$   (D) 6D<D) D&	!D) )D;c                   R  pV P                   P                  V4      pV P                  VP                  V4       V P	                  V\
        P                  4       V P                  W P                   P                  4       R# )c                      R # r   r   r   r   r   cb-BaseEventLoopTests.test_call_soon.<locals>.cb      r   N)	rc   	call_soonrA   	_callbackassertIsInstancer   r   r   r   rE   r   r   s   &  r   test_call_soon!BaseEventLoopTests.test_call_soon  s[    	 II#b)a0a))*r   c                    V P                   P                  R 4       V P                  \        R4      ;_uu_ 4        V P                   P	                  ^4       RRR4       R#   + '       g   i     R# ; i)Tza callable objectN)rc   	set_debugr   r   r   rE   s   &r   test_call_soon_non_callable.BaseEventLoopTests.test_call_soon_non_callable  sJ    		D!##I/BCCII" DCCCs   A  A1	c                   R  pV P                   P                  RV4      pV P                  V\        P                  4       V P                  W P                   P                  4       V P                  W P                   P                  4       V P                  \        RR7      ;_uu_ 4        V P                   P                  RV4       RRR4       R#   + '       g   i     R# ; i)c                      R # r   r   r   r   r   r   .BaseEventLoopTests.test_call_later.<locals>.cb  r   r         $@zdelay must not be Noner   N)rc   
call_laterr   r   TimerHandler   r   assertNotInr   rl   r   r   s   &  r   test_call_later"BaseEventLoopTests.test_call_later  s    	 II  r*a!4!45a--.II,,-y.FGGII  r* HGGGs   )CC!	c                <  a . oV3R  lp\         P                  ! 4       V P                  n        V P                  P	                  RVR4       V P                  P	                  RVR4       \
        P                  ! V P                  4       V P                  SRR.4       R# )c                 *   < SP                  V 4       R # r   )append)argcallss   &r   r   >BaseEventLoopTests.test_call_later_negative_delays.<locals>.cb   s    LLr   abN)r   rd   rc   rq   r   r-   run_brieflyrA   )rE   r   r   s   & @r   test_call_later_negative_delays2BaseEventLoopTests.test_call_later_negative_delays  ss    	 %)IIK		!		RS)		RS)tyy)c
+r   c                ~  a  V 3R  lp\         P                  ! 4       S P                  n        RpS P                  P	                  4       V,           pS P                  P                  W14       S P                  P	                  4       pS P                  P                  4        S P                  P	                  4       V,
          pS P                  WR\        P                  ,
          4       S P                  \        RR7      ;_uu_ 4        S P                  P                  RV4       RRR4       R#   + '       g   i     R# ; i)c                  <   < S P                   P                  4        R # r   rc   stopr   s   r   r   4BaseEventLoopTests.test_time_and_call_at.<locals>.cb*  s    IINNr   皙?zwhen cannot be Noner   N)r   rd   rc   rq   timecall_atr   assertGreaterEqualr-   	CLOCK_RESrl   r   )rE   r   delaywhent0dts   f     r   test_time_and_call_at(BaseEventLoopTests.test_time_and_call_at)  s    	 %)IIK		!yy~~%'		$#YY^^		YY^^" 	J,@,@$@Ay.CDDIIdB' EDDDs   D++D<	c                   R  pVP                  V4       V'       d   RpV P                  \        V4      ;_uu_ 4        VP                  V4       RRR4       V P                  \        V4      ;_uu_ 4        VP	                  ^<V4       RRR4       V P                  \        V4      ;_uu_ 4        VP                  VP                  4       ^<,           V4       RRR4       R# VP                  V4       VP	                  ^<V4       VP                  VP                  4       ^<,           V4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)c                      R # r   r   r   r   r   r   +BaseEventLoopTests.check_thread.<locals>.cb<  r   r   zMNon-thread-safe operation invoked on an event loop other than the current oneN)r   r   r   r   r   r   r   )rE   rc   debugr   r   s   &&&  r   check_threadBaseEventLoopTests.check_thread;  s    	 	u*C''c::r" ;''c::B' ;''c::TYY[2-r2 ;: NN2OOB#LLr)2. ;::::::s#   D,5D?.(E,D<	?E	E#	c                V  a a V 3R  loRV3R llp\         P                  ! 4       S P                  n        \         P                  ! 4       S P                  n        V! S P                  R4       V! S P                  R4       V! S P                  RRR7       V! S P                  RRR7       R# )c                   < VP                  4         V'       de   \        P                  ! 4       p \        P                  ! V4       SP                  W4       \        P                  ! R 4       VP                  4        MSP                  W4       V P                  VP                  R 4       R #   \        P                  ! R 4       TP                  4        i ; i  \         d(   pT P                  TP                  T4        R p?R # R p?ii ; ir   )r   r   rb   r   rg   r  r~   call_soon_threadsafe
set_result	Exceptionset_exception)rc   r   r  create_loopfutloop2excrE   s   &&&&&  r   check_in_thread=BaseEventLoopTests.test_check_thread.<locals>.check_in_threadO  s    JJL@'557E&..u5))$6..t4%%d2 ))#..$?  ..t4  B))#*;*;SAABs3   C C 'B. 8C .(CC D$DDFc                 $  < \         P                  ! 4       pV P                  4       pV P                  VP                  4       WWV3p\         P
                  ! SVR 7      pVP                  4        V P                  V4       VP                  4        R# ))targetr   N)	r   r   r   r   r   Threadstartr   join)rc   r  r  r   r  r   threadr  s   &&&    r   test_thread9BaseEventLoopTests.test_check_thread.<locals>.test_threadc  sk    OO%E$$&CNN599%S9D%%_4HFLLN##C(KKMr   T)r  Nr   )r   rd   rc   rq   rr   )rE   r  r  s   f @r   test_check_thread$BaseEventLoopTests.test_check_threadN  sx    	@(	 %)IIK		!#'99;		  	DIIt$ 	DIIu% 	DIIt6 	DIIu$7r   c                   \         P                  ! \        P                  ! 4       R ,           R RV P                  R4      p\         P                  ! \        P                  ! 4       R,           R RV P                  R4      pVP                  4        \        P                  ! 4       V P                  n        V P                  P                  P                  V4       V P                  P                  P                  V4       V P                  P                  4        V P                  P                  P                  P                  ^ ,          ^ ,          pT P                  RTu;8  ;'       d    R8  Mu V4       V P!                  V.V P                  P                  4       V P                  V P                  P                  P"                  4       R# )g      @c                      R # r   r   r   r   r   r   3BaseEventLoopTests.test__run_once.<locals>.<lambda>~  s    r   Nr   c                      R # r   r   r   r   r   r   r    s    $r   g      #@g      %@r   )r   r   r   	monotonicrc   r   r   rd   rq   r   r   	_run_oncere   rf   	call_argsr   rA   called)rE   h1h2ts   &   r   test__run_once!BaseEventLoopTests.test__run_once}  s*     !1C!7r!%D2  !1D!8,!%D2 			$(IIK		!		##B'		##B'		II&&003A6a$*"tyy334		11889r   c                   V P                   P                  R 4       V P                  V P                   P                  4       4       V P                   P                  R4       V P	                  V P                   P                  4       4       R# )TFN)rc   r   r   	get_debugr|   r   s   &r   test_set_debug!BaseEventLoopTests.test_set_debug  sZ    		D!		++-.		E",,./r   c                  aa R oRoVV3R lp\         P                  ! \        P                  ! 4       ^,
          WP                  3V P                  R 4      p\
        P                  ! 4       V P                  n        V P                  P                  P                  V4       V P                  P                  4        V P                  S4       V P                  S.\        V P                  P                  4      4       R # )NFc                 0   < R oV P                  R 4      oR# )Tc                      R # r   r   r   r   r   r   OBaseEventLoopTests.test__run_once_schedule_handle.<locals>.cb.<locals>.<lambda>  s    Dr   N)r   )rc   handle	processeds   &r   r   =BaseEventLoopTests.test__run_once_schedule_handle.<locals>.cb  s    I^^L1Fr   )r   r   r   r  rc   r   rd   rq   r   r   r   r   rA   listr   )rE   r   r   r0  r1  s   &  @@r   test__run_once_schedule_handle1BaseEventLoopTests.test__run_once_schedule_handle  s    		2
  01 4b99, $		41 %)IIK		!		##A&			"&4		(8(8#9:r   c                   \         P                  ! 4       V P                  n        T P	                  ^ \
        P                  u;8  ;'       d    R8  Mu 4       R p^pV P                  P                  RV4       ^p\        ^4       F/  pV P                  P                  RV4      pVP                  4        K1  	  V^,          p\        ^4       F/  pV P                  P                  ^dV4      pVP                  4        K1  	  V P                  W2,           \
        P                  4       V P                  V P                  P                  V4       V P                  P                  4        V^,          pV P                  V P                  P                  V4       V P                  \        V P                  P                   4      W2,           4       \#        \$        P&                  ! \
        P                  \
        P                  ,          4      4      ^,           p\)        \
        P                  V,
          ^ 4      pW',          p\        V4       F  pV P                  P                  RV4       K!  	  W6,          p\        V4       F/  pV P                  P                  RV4      pVP                  4        K1  	  V P                  \        V P                  P                   4      W2,           4       V P                  P                  4        V P                  \        V P                  P                   4      V4       T P	                  \+        V P                  P                    Uu. uF  qDP,                  '       * NK  	  up4      4       R# u upi )r@   g      ?c                      R # r   r   r   r   r   r   EBaseEventLoopTests.test__run_once_cancelled_event_cleanup.<locals>.cb  r   r     i  N)r   rd   rc   rq   r   r   %_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr   ranger   assertLessEqual_MIN_SCHEDULED_TIMER_HANDLESrA   _timer_cancelled_countr   lenr   intmathceilmaxall
_cancelled)rE   r   not_cancelled_countcancelled_countxr   add_cancel_countadd_not_cancel_counts   &       r   &test__run_once_cancelled_event_cleanup9BaseEventLoopTests.test__run_once_cancelled_event_cleanup  s   $(IIK		!AAGGCG	I	  		T2&
 qA		$$T2.AHHJ 
 	1qA		$$S"-AHHJ 
 	_B44	6 	99?K		199?KTYY1121	3
 tyy44==> ? @BCD  #;#K#K$ ! 	3+,AII  r* - 	+'(A		$$T2.AHHJ )
 	TYY1121	3 			 	TYY1124GH 	tyy7K7KL7K!-7KLMNLs   M<c                \    V P                  \        V P                  P                  R 4       R# )blahN)rl   r   rc   r   r   s   &r   "test_run_until_complete_type_error5BaseEventLoopTests.test_run_until_complete_type_error  s!    )II((&	2r   c                    V P                   P                  4       pV P                  4       pV P                  VP                  4       V P                  \        VP                  V4       R # r   )rc   r   new_test_loop
addCleanupr~   rl   
ValueErrorr   )rE   task
other_loops   &  r   test_run_until_complete_loop/BaseEventLoopTests.test_run_until_complete_loop  sO    yy&&('')

(()*))4	1r   c                  a  ! R  R\         4      oR pV3R lp\        P                  ! 4       V P                  n        V P                  P                  V4       V P                  S4      ;_uu_ 4        V P                  P                  V! R4      4       RRR4       V P                  P                  V! R4      4       R#   + '       g   i     L3; i)c                       ] tR tRtRtR# )]BaseEventLoopTests.test_run_until_complete_loop_orphan_future_close_loop.<locals>.ShowStopperi   r   Nr   r   r   r   ShowStopperr[         r   r\  c                 N   "   \         P                  ! V 4      G R j  xL
  R #  L5ir   r   sleep)r   s   &r   fooUBaseEventLoopTests.test_run_until_complete_loop_orphan_future_close_loop.<locals>.foo  s     --&&&s   %#%c                     < S hr   r   )r\  s   r   throwWBaseEventLoopTests.test_run_until_complete_loop_orphan_future_close_loop.<locals>.throw  s	    r   r   Ng?)
SystemExitr   rd   rc   rq   r   rl   r   )rE   ra  rd  r\  s   &  @r   5test_run_until_complete_loop_orphan_future_close_loopHBaseEventLoopTests.test_run_until_complete_loop_orphan_future_close_loop  s    	* 		'	 %)IIK		!		E"{++II((S2 ,
 			$$SX. ,+s   2"B??C	c                   \         P                  R R.pV P                  \        V P                  P
                  V P                  P                  \        P                  4       V P                  \        V P                  P
                  V P                  P                  \        P                  V4       V P                  \        V P                  P
                  V P                  P                  \        P                  \         P                  ^{4       V P                  ! \        V P                  P
                  V P                  P                  \        P                  .VO5RR/  V P                  ! \        V P                  P
                  V P                  P                  \        P                  .VO5RR/  V P                  ! \        V P                  P
                  V P                  P                  \        P                  .VO5RR/  R# )-cpassuniversal_newlinesTshellbufsize   N)	sys
executablerl   r   rc   r   subprocess_execr   SubprocessProtocol)rE   r   s   & r   !test_subprocess_exec_invalid_args4BaseEventLoopTests.test_subprocess_exec_invalid_args  s   f- 	)II(($))*C*C&&	(
 	)II(($))*C*C&&	.
 	)II(($))*C*C&&	=
 	)		$$dii&?&?&&	H)-	HBF	H 	)II(($))*C*C&&	;)-	;59	; 	)II(($))*C*C&&	=)-	=7;	=r   c           	     J   V P                  \        V P                  P                  V P                  P                  \
        P                  ^{4       V P                  \        V P                  P                  V P                  P                  \
        P                  \        P                  RR.4       V P                  \        V P                  P                  V P                  P                  \
        P                  RRR7       V P                  \        V P                  P                  V P                  P                  \
        P                  RRR7       V P                  \        V P                  P                  V P                  P                  \
        P                  RRR7       R	# )
{   rj  rk  zexit 0T)rl  )rm  ro  )rn  N)	rl   r   rc   r   subprocess_shellr   rs  rp  rq  r   s   &r   "test_subprocess_shell_invalid_args5BaseEventLoopTests.test_subprocess_shell_invalid_args/  s1   )II(($))*D*D&&	- 	)II(($))*D*D&&v(F	H
 	)II(($))*D*D&&T 	 	K 	)II(($))*D*D&& 	 	> 	)II(($))*D*D&&$ 	 	@r   c                  a  \         P                  ! 4       S P                  n        R  p\         P                  ! R4      ;_uu_ 4       pS P                  P                  4       pS P                  P                  W4       VP                  V 3R l4       S P                  P                  4        VP                  P                  \        P                  ! R4      \        \        \        3R7       RRR4       \         P                  ! R4      ;_uu_ 4       pS P                  P                  4       pS P                  P                  RW4       VP                  V 3R l4       S P                  P                  4        VP                  P                  \        P                  ! R4      \        \        \        3R7       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                 :    V P                  R 4       ^^ ,           R# TN)r  r  s   &r   
zero_errorHBaseEventLoopTests.test_default_exc_handler_callback.<locals>.zero_errorF  s    NN4 aCCr   asyncio.base_events.loggerc                 8   < SP                   P                  4       # r   r   r  rE   s   &r   r   FBaseEventLoopTests.test_default_exc_handler_callback.<locals>.<lambda>N      diinn.>r   Exception in callback.*zeroexc_infoNr   c                 8   < SP                   P                  4       # r   r   r  s   &r   r   r  X  r  r   )r   rd   rc   rq   r5   r   r   add_done_callbackr   errorassert_called_withr-   MockPatternZeroDivisionErrorMOCK_ANYr   )rE   r  logr  s   f   r   !test_default_exc_handler_callback4BaseEventLoopTests.test_default_exc_handler_callbackC  sN   $(IIK		!	
 ZZ455))))+CII
0!!">?II!!#II((&&'DE+Xx@ ) B 6 ZZ455))))+CII  z7!!">?II!!#II((&&'DE+Xx@ ) B 65 65 655s   B%GB&GG	G&	c                &  a  \         P                  ! 4       S P                  n        R  p\         P                  ! R4      ;_uu_ 4       p\
        P                  ! V! 4       S P                  R7      pVP                  V 3R l4       S P                  P                  4        Rp\        P                  ! 4        VP                  P                  \        P                  ! R4      \        \         \         3R7       RRR4       R#   + '       g   i     R# ; i)c                  `   "   \         P                  ! R 4      G Rj  xL
  ^^ ,           R#  L5i)r   Nr_  r   r   r   zero_error_coroIBaseEventLoopTests.test_default_exc_handler_coro.<locals>.zero_error_coroa  s%     --%%%aCC &s   .,.r  rc   c                  8   < SP                   P                  4       # r   r   )r   rE   s   *r   r   BBaseEventLoopTests.test_default_exc_handler_coro.<locals>.<lambda>h  s    		0@r   Nz.*exception was never retrievedr  )r   rd   rc   rq   r5   r   ensure_futurer  r   r   
gc_collectr  r  r-   r  r  r  )rE   r  r  r  s   f   r   test_default_exc_handler_coro0BaseEventLoopTests.test_default_exc_handler_coro^  s    $(IIK		!	
 ZZ455''(9		JC!!"@AII!!#C II((&&'HI+Xx@ ) B 6555s   B.C??D	c                    V P                  \        R 4      ;_uu_ 4        V P                  P                  R4       RRR4       R#   + '       g   i     R# ; i)zA callable object or NonespamN)r   r   rc   set_exception_handlerr   s   &r   test_set_exc_handler_invalid/BaseEventLoopTests.test_set_exc_handler_invalidq  s8    ##I/JKKII++F3 LKKKs   AA	c                  a a R  oV V3R lpS P                   P                  R4       \        P                  ! 4       S P                   n        S P                  S P                   P                  4       4       \        P                  ! 4       pS P                   P                  V4       S P                  S P                   P                  4       V4       V! 4       pVP                  S P                   R\        R\        P                  ! R4      RVRVP                  /4       VP                  4        S P                   P                  R4       \        P                  ! R	4      ;_uu_ 4       pV! 4        VP                   P                  \        P                  ! R
4      \"        \        \        3R7       RRR4       S P%                  VP&                  4       R#   + '       g   i     L-; i)c                      ^^ ,           R# r?   Nr   r   r   r   r  BBaseEventLoopTests.test_set_exc_handler_custom.<locals>.zero_errorv  s    aCCr   c                  r   < SP                   P                  S4      p SP                   P                  4        V # r   rc   r   r   )r0  rE   r  s    r   run_loop@BaseEventLoopTests.test_set_exc_handler_custom.<locals>.run_loopy  s,    YY((4FII!Mr   T	exceptionmessagez!Exception in callback.*zero_errorr0  source_tracebackNr  r  r  )rc   r   r   rd   rq   rC   get_exception_handlerr  r   r  r  r-   r  _source_traceback
reset_mockr5   r  r  r|   r"  )rE   r  mock_handlerr0  r  r  s   f    @r   test_set_exc_handler_custom.BaseEventLoopTests.test_set_exc_handler_customu  s]   		
 			D!$(IIK		!$))99;<yy{		''5dii557F''		z-- CEf 8 84
 	 	!		''-ZZ455JII((".. =?"3Xx!H ) J 6 	,,- 65s   %AGG"	c                  a  V 3R  lpR p\         P                  ! 4       S P                  n        S P                  P	                  V4       \         P
                  ! R4      ;_uu_ 4       pV! 4        VP                  P                  \        P                  ! R4      \        \        \        3R7       RRR4       R#   + '       g   i     R# ; i)c                  x   < R  p SP                   P                  V 4       SP                   P                  4        R# )c                      ^^ ,           R# r  r   r   r   r   r  TBaseEventLoopTests.test_set_exc_handler_broken.<locals>.run_loop.<locals>.zero_error      !r   Nr  )r  rE   s    r   r  @BaseEventLoopTests.test_set_exc_handler_broken.<locals>.run_loop  s*    II
+II!r   c                     \        R 4      hr  )AttributeErrorrc   contexts   &&r   handler?BaseEventLoopTests.test_set_exc_handler_broken.<locals>.handler  s     ((r   r  z$Unhandled error in exception handlerr  N)r   rd   rc   rq   r  r5   r  r  r-   r  r  r  )rE   r  r  r  s   f   r   test_set_exc_handler_broken.BaseEventLoopTests.test_set_exc_handler_broken  s    	"	) %)IIK		!		''0ZZ455JII((&&:<((H= ) ? 6555s   (AB::C	c                  aa R o ! V3R lR\         P                  4      pV! 4       oV P                  SP                  4       \        P
                  ! S4       V3R lp\        P                  ! R4      ;_uu_ 4       pV! 4        VP                  P                  RRR7       R R R 4       R pR oSP                  V4       \        P                  ! R4      ;_uu_ 4       pV! 4        VP                  P                  \        P                  ! R	4      RR7       V P                  R
S4       V P                  \        SR
,          R,          4      \         4       R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; i)Nc                   r   <a  ] tR tRt o ]P
                  ! 4       t]P
                  ! 4       tV3R ltRt	V t
R# )@BaseEventLoopTests.test_default_exc_handler_broken.<locals>.Loopi  c                   < Vo\        R 4      hr  rT  )rE   r  _contexts   &&r   default_exception_handlerZBaseEventLoopTests.test_default_exc_handler_broken.<locals>.Loop.default_exception_handler  s    " ((r   r   N)r   r   r   r   r   rd   re   rq   r  r   rY   )r[   r  s   @r   Loopr    s%     		I"iikO) )r   r  c                  P   < R  p SP                  V 4       SP                  4        R# )c                      ^^ ,           R# r  r   r   r   r   r  XBaseEventLoopTests.test_default_exc_handler_broken.<locals>.run_loop.<locals>.zero_error  r  r   N)r   r   )r  rc   s    r   r  DBaseEventLoopTests.test_default_exc_handler_broken.<locals>.run_loop  s    NN:&NNr   r  z&Exception in default exception handlerTr  c                     \        R 4      h)hamr  r  s   &&r   custom_handlerJBaseEventLoopTests.test_default_exc_handler_broken.<locals>.custom_handler  s    U##r   z9Exception in default exception.*while handling.*in customr  r  )r   rb   rS  r~   r   rg   r   r5   r  r  r  r-   r  r   r   typer  )rE   r  r  r  r  r  rc   s   &    @@r   test_default_exc_handler_broken2BaseEventLoopTests.test_default_exc_handler_broken  s.   		);,, 		) v

#t$	 ZZ455JII((8 )  6	$ "">2ZZ455JII((&& (C D )  MM)X.MM$x	2;?@+- 65 65 655s   =%E A8E3 E0	3F	c                   V P                  \        R 4      ;_uu_ 4        V P                  P                  ^4       RRR4       V P	                  V P                  P                  4       4       R#   + '       g   i     L;; i)z'task factory must be a callable or NoneN)r   r   rc   set_task_factoryrC   get_task_factoryr   s   &r   test_set_task_factory_invalid0BaseEventLoopTests.test_set_task_factory_invalid  sa    ##@B B II&&q)B
 	$))4467B Bs   A..A>	c                  a \         P                  ! 4       V P                  n         ! R  R\        P
                  4      oR pV3R lpV P                  V P                  P                  4       4       V P                  P                  V4       V P                  V P                  P                  4       V4       V P                  P                  V! 4       4      pV P                  \        VS4      4       V P                  P                  V4       V P                  P                  R4       V P                  V P                  P                  4       4       V P                  P                  V! 4       4      pV P                  \        V\        P
                  4      4       V P                  \        VS4      4       V P                  P                  V4       R# )c                       ] tR tRtRtR# )8BaseEventLoopTests.test_set_task_factory.<locals>.MyTaski  r   Nr   r   r   r   MyTaskr    r]  r   r  c                     "   R # 5ir   r   r   r   r   coro6BaseEventLoopTests.test_set_task_factory.<locals>.coro          c                    < S! WR 7      # r  r   )rc   r  r  s   &&r   r   :BaseEventLoopTests.test_set_task_factory.<locals>.<lambda>  s
    VD%<r   N)r   rd   rc   rq   r   TaskrC   r  r  r   create_taskr   
isinstancer   r|   )rE   r  factoryrU  r  s   &   @r   test_set_task_factory(BaseEventLoopTests.test_set_task_factory  s5   $(IIK		!	W\\ 		 =$))4467		""7+dii002G<yy$$TV,
401		$$T*		""4($))4467yy$$TV,
467D&12		$$T*r   c                   R P                  R4      p\        RRV4      w  r#pV P                  VP                  4       R4       \        RVRRR7      w  r#pV P                  VP                  4       R4       \        RVRRR7      w  r#pV P                  VP                  4       R4       \        RRVRR7      w  r#pV P                  VP                  4       R4       \        RR	R
RV4      w  r#pV P                  VP                  4       R4       R# )
z-Erj  s   Falser;   )PYTHONASYNCIODEBUGPYTHONDEVMODErP   s   True)r  z-XdevN)zimport asynciozloop = asyncio.new_event_loop()zprint(loop.get_debug()))r  r   rA   rstrip)rE   codestsstdoutstderrs   &    r   test_env_var_debug%BaseEventLoopTests.test_env_var_debug  s   yy ' ( /tT4@V(3.tTBD=?AV 	(3.tTBE=?AV 	'2.tT4BEGV(3 /tT5/3T;V'2r   c                <  aa  ! R  R\         P                  4      oR p ! VV3R lR\        P                  4      pV! 4       oV P	                  S4       V! 4       p\         P
                  ! VSR7      pV P                  VS4       RVn        VP                  4        R# )c                       ] tR tRtRtR# )3BaseEventLoopTests.test_create_task.<locals>.MyTaski   r   Nr   r   r   r   r  r     r]  r   r  c                     "   R # 5ir   r   r   r   r   test1BaseEventLoopTests.test_create_task.<locals>.test#  r  r  c                   0   <a  ] tR tRt o VV3R ltRtV tR# )6BaseEventLoopTests.test_create_task.<locals>.EventLoopi&  c                   < S! VSR 7      # r  r   )rE   r  r  rc   s   &&r   r  BBaseEventLoopTests.test_create_task.<locals>.EventLoop.create_task'  s    d..r   r   N)r   r   r   r   r  r   rY   )r[   r  rc   s   @r   	EventLoopr  &  s     / /r   r  r  FN)	r   r  r   rb   rg   r  r   _log_destroy_pendingr~   )rE   r  r  r  rU  r  rc   s   &    @@r   test_create_task#BaseEventLoopTests.test_create_task  s    	W\\ 			/ 	/11 	/ {D!v$$T5dF+ %*!

r   c           	        R  p\         P                  ! 4       pVP                  4        \        P                  ! RR7      ;_uu_ 4       pV P                  \        4      ;_uu_ 4        \         P                  ! V! 4       VR7       RRR4       V P                  \        V4      ^ 4       RRR4       R#   + '       g   i     L5; i  + '       g   i     R# ; i)c                     "   R # 5ir   r   r   r   r   r  CBaseEventLoopTests.test_create_task_error_closes_coro.<locals>.test6  r  r  T)recordr  N)
r   new_event_loopr~   warningscatch_warningsrl   r   r  rA   r?  )rE   r  rc   ws   &   r   "test_create_task_error_closes_coro5BaseEventLoopTests.test_create_task_error_closes_coro5  s    	%%'

$$D11Q""<00%%df48 1SVQ' 2100 211s$   C&B1	#C1C<CC	c                6   R  p\         P                  ! 4       pVP                  V! 4       RR7      p V P                  VP	                  4       R4       VP                  V4       VP                  4        R#   TP                  T4       TP                  4        i ; i)c                     "   R # 5ir   r   r   r   r   r  LBaseEventLoopTests.test_create_named_task_with_default_factory.<locals>.testA  r  r  	test_taskr1   N)r   r  r  rA   get_namer   r~   )rE   r  rc   rU  s   &   r   +test_create_named_task_with_default_factory>BaseEventLoopTests.test_create_named_task_with_default_factory@  s{    	 %%'[9	T]]_k:##D)JJL ##D)JJLs    A5 5#Bc                ^   R  pR p\         P                  ! 4       pVP                  V4       VP                  V! 4       RR7      p V P	                  VP                  4       R4       VP                  V4       VP                  4        R#   TP                  T4       TP                  4        i ; i)c                 4    \         P                  ! V3R V /VB # r  )r   r  )rc   r  r   s   &&,r   task_factorySBaseEventLoopTests.test_create_named_task_with_custom_factory.<locals>.task_factoryM  s    <<:4:6::r   c                     "   R # 5ir   r   r   r   r   r  KBaseEventLoopTests.test_create_named_task_with_custom_factory.<locals>.testP  r  r  r  r  N)r   r  r  r  rA   r  r   r~   )rE   r  r  rc   rU  s   &    r   *test_create_named_task_with_custom_factory=BaseEventLoopTests.test_create_named_task_with_custom_factoryL  s    	;	 %%'l+[9	T]]_k:##D)JJL ##D)JJLs    B	 	#B,c                   R  p\         P                  ! 4       V P                  n        \         P                  ! 4       V P                  n         V P                  P                  V! 4       4       V P                  P                  4        \        P                  ! 4        V P                  V P                  P                  P                  4       R#   \         d     Lmi ; i)c                     "   \         h5ir   KeyboardInterruptr   r   r   raise_keyboard_interruptXBaseEventLoopTests.test_run_forever_keyboard_interrupt.<locals>.raise_keyboard_interrupt`       ##   	N)r   rd   rc   rq   call_exception_handlerr   r%  r~   r   r  r|   r"  )rE   r&  s   & r   #test_run_forever_keyboard_interrupt6BaseEventLoopTests.test_run_forever_keyboard_interrupt\  s    	$ %)IIK		!+/99;		(	II(()A)CD 			99@@A ! 		s    C CCc                  a a R  p\         P                  ! 4       S P                  n        S P	                  \
        4      ;_uu_ 4        S P                  P                  V! 4       4       RRR4       VV 3R loRSn        S P                  P                  S P                  P                  S4       S P                  P                  4        S P                  SP                  4       R#   + '       g   i     L; i)c                     "   \         h5ir   r$  r   r   r   r&  ZBaseEventLoopTests.test_run_until_complete_baseexception.<locals>.raise_keyboard_interruptr  r(  r)  Nc                  J   < SP                   P                  4        R S n        R# r}  )rc   r   r"  )funcrE   s   r   r1  FBaseEventLoopTests.test_run_until_complete_baseexception.<locals>.funcz  s    IINNDKr   F)r   rd   rc   rq   rl   r%  r   r"  r   r   r   )rE   r&  r1  s   f @r   %test_run_until_complete_baseexception8BaseEventLoopTests.test_run_until_complete_baseexceptiono  s    	$ %)IIK		!011II(()A)CD 2	 		DII//6		$ 21s   !C%%C5	c                "  a aaaaa \        4       o^ oRoVVVV 3R lpVVV 3R loVV 3R loVS P                  n        S3S P                  P                  P                  n        \        ^^4       F  pS P                  RV,          4      ;_uu_ 4        S P                  P                  S P                  P                  4       S P                  P                  4        S P                  S^4       RRR4       K  	  R#   + '       g   i     K  ; i)r@   Nc                 P   < SV 9   d   SP                   P                  S4      oR # R # r   rc   r   )
event_listdo_eventdoerevent_sentinelrE   s   &r   proc_eventsZBaseEventLoopTests.test_single_selecter_event_callback_after_stopping.<locals>.proc_events  s$    +yy**84 ,r   c                  P   < S ^,          o SP                   P                  S4       R# r  r7  )	callcountclear_selectorrE   s   r   r9  WBaseEventLoopTests.test_single_selecter_event_callback_after_stopping.<locals>.do_event  s    NIII/r   c                  r   < S P                  4        RSP                  P                  P                  n        R # r_   )r   rc   re   rf   r/   )r:  rE   s   r   r@  ]BaseEventLoopTests.test_single_selecter_event_callback_after_stopping.<locals>.clear_selector  s$    KKM68DII&&3r   z	Loop %d/2)objectrc   rq   re   rf   r/   r;  subTestr   r   r   rA   )rE   r<  ir?  r@  r9  r:  r;  s   f  @@@@@r   2test_single_selecter_event_callback_after_stoppingEBaseEventLoopTests.test_single_selecter_event_callback_after_stopping  s      		5 	5
	0
	9 %0		!3A2C		""/q!AkAo..		##DIINN3		%%'  A. /. ...s   AC==Dc                   a ^ oV3R lp\         P                  ! 4       V P                  n        V P                  P	                  V4       \
        P                  ! V P                  4       V P                  S^4       R# )r@   c                     < S ^,          o R# r  r   counts   r   callback2BaseEventLoopTests.test_run_once.<locals>.callback      QJEr   N)r   rd   rc   rq   r   r-   run_oncerA   )rE   rM  rL  s   & @r   test_run_once BaseEventLoopTests.test_run_once  sW    
 	 %)IIK		!		H%DII&"r   c                   \         P                  ! 4       V P                  n        V P                  P	                  4        V P                  P                  4        V P                  P                  P                  P                  ^ 4       R# )r@   N)	r   rd   rc   rq   r   r   re   rf   assert_called_once_withr   s   &r   test_run_forever_pre_stopped/BaseEventLoopTests.test_run_forever_pre_stopped  sP    $(IIK		!						""::1=r   c                x  a \         P                  ! 4       V P                  n        ^ oV3R lpV P                  P	                  V4       V P                  P                  4        V P                  \        P                  ! 4       V P                  4       V P                  V P                  P                  4       4       \        ^
4       F  pV P                  P                  4        K  	  V P                  P                  4        V P                  \        4      ;_uu_ 4        \        P                  ! 4        RRR4       V P!                  V P                  P                  4       4       V P                  V P                  P                  P"                  ^
4       V P                  S^4       R#   + '       g   i     L}; i)r@   c                     < S ^,          o R# r  r   rK  s   r   rM  HBaseEventLoopTests.test_custom_run_forever_integration.<locals>.callback  rO  r   N)r   rd   rc   rq   r   _run_forever_setuprA   r   get_running_loopr   
is_runningr;  r   _run_forever_cleanuprl   r   r|   
call_count)rE   rM  rF  rL  s   &  @r   #test_custom_run_forever_integration6BaseEventLoopTests.test_custom_run_forever_integration  s+    %)IIK		!	 			H% 			$$& 	113TYY?		,,./ rAII!  			&&( |,,$$& ---/0 	22==rB" -,s   F))F9	c                   aaa"   R RRRRR/oV3R lpV! 4       pVP                  4       oVVV3R lo\        P                  ! S! 4       4       S# 5i)startedFstopped	finalizedc                 V   <"   R SR&    R F  p V 5x  K
  	  R SR&   R#   R SR&   i ; i5i)Trb  rd  N)ZEROONETWOTHREEFOURr   )itemstatuss    r   agen;BaseEventLoopTests.leave_unfinalized_asyncgen.<locals>.agen  s;      $F9+CDJ D '+{#d{#s   ) )&)c                     <"    SP                  4       G R j  xL
 p T R8X  d   RSR&   R # \        P                  ! S! 4       4       R #  L/  \         d     R # i ; i5i)Nri  Trc  )	__anext__StopAsyncIterationr   r  )rk  aiiter_onerl  s    r   rs  ?BaseEventLoopTests.leave_unfinalized_asyncgen.<locals>.iter_one  sU     \\^+ w$(y!
+ ,% s7   AA
 AA
 +AA
 
AAAA)	__aiter__r   r  )rE   rm  agrr  rs  rl  s   &  @@@r   leave_unfinalized_asyncgen-BaseEventLoopTests.leave_unfinalized_asyncgen  sS      UUu&	+ V\\^	, 	HJ's   AAc                   \         P                  ! 4       V P                  n        \         P                  ! 4       V P                  n        \
        P                  ! 4       ;_uu_ 4        V P                  P                  V P                  4       4      pVR ,          '       g#   \        P                  ! V P                  4       K1  V P                  VR,          4       V P                  VR ,          4       V P                  VR,          4       \
        P                  ! 4        \        P                  ! V P                  4       V P                  VR,          4       RRR4       R#   + '       g   i     R# ; i)rc  rb  rd  N)r   rd   rc   rq   rr   r   
disable_gcr   rw  r-   r   r   r|   r  rE   rl  s   & r    test_asyncgen_finalization_by_gc3BaseEventLoopTests.test_asyncgen_finalization_by_gc  s    $(IIK		!#'99;		 !!YY11$2Q2Q2STFY''&&tyy1OOF9-.OOF9-.VK01 ""499-OOF;/0 "!!!s   &8E B7E  E1	c                z   \         P                  ! 4       V P                  n        \         P                  ! 4       V P                  n        V P                  P                  R 4       \        P                  ! 4       ;_uu_ 4        V P                  P                  V P                  4       4      pVR,          '       g#   \        P                  ! V P                  4       K1  V P                  VR,          4       V P                  VR,          4       V P                  VR,          4       V P                  P                  V P                  P                  R\        P                  4      4       \        P                  ! V P                  4       V P                  VR,          4       RRR4       R#   + '       g   i     R# ; i)Trc  rb  rd  N)r   rd   rc   rq   rr   r   r   rz  r   rw  r-   r   r   r|   run_in_executorr  r{  s   & r   0test_asyncgen_finalization_by_gc_in_other_threadCBaseEventLoopTests.test_asyncgen_finalization_by_gc_in_other_thread  s    %)IIK		!#'99;		 		D!!!YY11$2Q2Q2STFY''&&tyy1OOF9-.OOF9-.VK01II((		))$0B0BCE""499-OOF;/0 "!!!s   8F):C%F))F:	r  )5r   r   r   r   ra   ry   r   r   r   r   r   r   r   r   r   r   r   r  r  r&  r*  r4  rK  rO  rW  rg  rt  ry  r  r  r  r  r  r  r  r  r  r  r  r  r   r+  r3  rG  rQ  rU  r_  rw  r|  r  r   rY   __classcell__ri   r[   s   @@r   r]   r]      s     '2I++=7*+#
	+
,($/&-8^:$0;&JOX21/&=:@(B6B&4".H?*.-`8+63<,(
 B&%&/<# >##J D11 1r   r]   c                   L   a  ] tR tRt o RtR
R ltR tR tR tR t	R t
R	tV tR# )MyProtoi!  Nc                    R V n         ^ V n        V'       d+   \        P                  ! 4       P	                  4       V n        R# R# INITIALN)statenbytesr   r[  r   done)rE   r   s   &&r   __init__MyProto.__init__$  s1    
002@@BDI r   c                b    V P                   V9  d   \        R V P                   : RV: 24      hR# zstate: z, expected: Nr  AssertionErrorrE   expecteds   &*r   _assert_stateMyProto._assert_state*  s/    ::X% 74::.XL!QRR &r   c                d    Wn         V P                  R 4       RV n        VP                  R4       R# )r  	CONNECTEDs%   GET / HTTP/1.0
Host: example.com

N)	transportr  r  writerE   r  s   &&r   connection_madeMyProto.connection_made.  s)    "9% 
FGr   c                l    V P                  R 4       V ;P                  \        V4      ,          un        R# )r  Nr  r  r?  rE   datas   &&r   data_receivedMyProto.data_received4  s"    ;'s4y r   c                6    V P                  R 4       RV n        R# )r  EOFN)r  r  r   s   &r   eof_receivedMyProto.eof_received8  s    ;'
r   c                    V P                  R R4       RV n        V P                  '       d   V P                  P                  R4       R# R# )r  r  CLOSEDNr  r  r  r  rE   r  s   &&r   connection_lostMyProto.connection_lost<  s9    ;.
999II  & r   r  r  r  r  r   )r   r   r   r   r  r  r  r  r  r  r  r   rY   rZ   s   @r   r  r  !  s0     DCSH!' 'r   r  c                   L   a  ] tR tRt o RtR
R ltR tR tR tR t	R t
R	tV tR# )MyDatagramProtoiC  Nc                `    R V n         ^ V n        V'       d   VP                  4       V n        R# R# r  )r  r  r   r  )rE   r   rc   s   &&&r   r  MyDatagramProto.__init__F  s(    
**,DI r   c                b    V P                   V8w  d   \        R V P                   : RV: 24      hR# r  r  r  s   &&r   r  MyDatagramProto._assert_stateL  s/    ::! 74::.XL!QRR "r   c                B    Wn         V P                  R 4       RV n        R# )r  INITIALIZEDN)r  r  r  r  s   &&r   r  MyDatagramProto.connection_madeP  s    "9%"
r   c                l    V P                  R 4       V ;P                  \        V4      ,          un        R# r  Nr  )rE   r  addrs   &&&r   datagram_received!MyDatagramProto.datagram_receivedU  s"    =)s4y r   c                (    V P                  R 4       R# r  )r  r  s   &&r   error_receivedMyDatagramProto.error_receivedY  s    =)r   c                    V P                  R 4       RV n        V P                  '       d   V P                  P                  R4       R# R# )r  r  Nr  r  s   &&r   r  MyDatagramProto.connection_lost\  s7    =)
999II  & r   r  FN)r   r   r   r   r  r  r  r  r  r  r  r   rY   rZ   s   @r   r  r  C  s.     D-S#
!*' 'r   r  c                   :  a a ] tR tRt oV 3R lt]P                  ! R4      R 4       t]R 4       t	]R 4       t
]R 4       tR tR	 tR
 tR t]P"                  ! ]! ]R4      R4      R 4       t]P"                  ! ]P,                  R4      R 4       tR tR tR tR t]R 4       tR t]R 4       tR t]P"                  ! ]P,                  R4      ]P@                  ! ]!PD                  PG                  R4      R4      ]R 4       4       4       t$]R 4       t%]R 4       t&]]P@                  ! ]'PP                  ;'       d    ]"PR                  ! 4       PT                  ^8  R4      R 4       4       t+R  t,]R! 4       t-R" t.R# t/R$ t0R% t1R& t2R' t3R( t4R) t5]R* 4       t6]R+ 4       t7]R, 4       t8]R- 4       t9R. t:R/ t;R0 t<]R1 4       t=]P"                  ! ]P,                  R24      R3 4       t>]R4 4       t?R5 t@]R6 4       tAR7 tB]P"                  ! ]! ]R84      R94      R: 4       tC]P                  R; 4       tER< tF]P@                  ! ]!PD                  R=8H  R>4      R? 4       tG]R@ 4       tH]RA 4       tIRB tJ]P                  ! RC4      RD 4       tKRE tL]P                  ! RC4      RF 4       tMRGtNVtOV ;tP# )HBaseEventLoopWithSelectorTestsic  c                   < \         SV `  4        \        P                  ! 4       V n        V P                  V P                  4       R # r   )r`   ra   r   SelectorEventLooprc   rg   rh   s   &r   ra   $BaseEventLoopWithSelectorTests.setUpe  s.    --/	DII&r   zsocket.getnameinfoc                    R  Vn         V P                  P                  V P                  P                  R4      4      pV P	                  V^*4       R# )c                      ^*# )*   r   )r   s   *r   r   ABaseEventLoopWithSelectorTests.test_getnameinfo.<locals>.<lambda>l  s    "r   N)abcrw  )side_effectrc   r   getnameinforA   )rE   m_gairs   && r   test_getnameinfo/BaseEventLoopWithSelectorTests.test_getnameinfoj  s=    ,II(()>)>|)LMBr   c                X  a aa	a
  ! R  R\         P                  4      pR o	V	V 3R lpRo
RR.oVV
3R lpWAn        VS P                  n        S P                  P                  VR^P4      pS P                  \        4      ;_uu_ 4       pS P                  P                  V4       RRR4       S P                  \        XP                  4      R	4       Ro
S P                  P                  VR^PR
R7      pS P                  \        4      ;_uu_ 4       pS P                  P                  V4       RRR4       S P                  VP                  \        4       VP                  P                   F  pS P                  V\        4       K  	  R#   + '       g   i     L; i  + '       g   i     Lx; i)c                       ] tR tRtRtR# )VBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors.<locals>.MyProtois  r   Nr   r   r   r   r  r  s  r]  r   r  c                     "   RR.# 5i   r  r?      r;   )z107.6.106.82P   r   r   kws   *,r   getaddrinfoZBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors.<locals>.getaddrinfov  s     779 9   c                  F   < SP                   P                  S! V / VB 4      # r   rc   r  r   kwdsr  rE   s   *,r   getaddrinfo_task_BaseEventLoopWithSelectorTests.test_create_connection_multiple_errors.<locals>.getaddrinfo_taskz  "    99((d)Cd)CDDr   err1err2c                  :   < S^,          o\        SS,          4      h)r?   )OSError)r   r  errorsidxs   *,r   _socketVBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors.<locals>._socket  s    1HC&+&&r   example.comNzMultiple exceptions: err1, err2T
all_errorsr   )r   Protocolr(   rc   r  create_connectionrl   r  r   rA   strr  ExceptionGroupr   
exceptions)rE   r0   r  r  r  r  cmer  r  r  s   f&      @@@r   &test_create_connection_multiple_errorsEBaseEventLoopWithSelectorTests.test_create_connection_multiple_errorsp  s@   	g&& 		9	E &!	'
 " 0		yy**7M2Fw''2II((. ( 	R\\*,MNyy**7M2RV*W~.."II((. / 	bllN;((A!!!W- ) (' /.s   FFF	F)	c           	       a  \         P                  ! 4       pW!P                  n        V 3R  lpVS P                  n        \         P                  P                  S P                  R\        P                  R7      ;_uu_ 4        S P                  P                  \        R^P4      pS P                  \        P                  4      ;_uu_ 4        S P                  P                  V4       RRR4       S P                  VP                  P                   4       RRR4       R#   + '       g   i     L?; i  + '       g   i     R# ; i)c                     < SP                   P                  4       p\        P                  \        P                  ^ RR3pVP                  V.4       V# )r@   r;   	127.0.0.1r  )rc   r   r(   r   r"   r  )r   r  r  r  rE   s   *,  r   r  RBaseEventLoopWithSelectorTests.test_create_connection_timeout.<locals>.getaddrinfo  sE    ))))+CNNF$6$62%'DNND6"Jr   sock_connect)r  r  N)r   rd   r(   r/   rc   r  r5   rD  r   TimeoutErrorr  r  rl   r   r   r~   r"  )rE   r0   sockr  r  s   f&   r   test_create_connection_timeout=BaseEventLoopWithSelectorTests.test_create_connection_timeout  s     yy{'+$	 !,		ZZtyy.+2+?+?  A A99..wRHD""7#7#788		,,T2 9OODJJ--.A A 98A A As%    A	D/	D	%-D/D,'D//E 	c           	       a a R  oVV 3R lpVS P                   n        \        P                  ! R4      ;_uu_ 4       pR pWCn        S P                   P                  \        R^PRR7      pS P                  \        R4      ;_uu_ 4        S P                   P                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	c                     "   \         P                  \         P                  ^ RR3\         P                  \         P                  ^ RR3.# 5i)r@   r;   r  )::1r  )r(   r   r"   r   r  s   *,r   r  jBaseEventLoopWithSelectorTests.test_create_connection_happy_eyeballs_empty_exceptions.<locals>.getaddrinfo  sB     ^^V%7%7B@QR__f&8&8!RMO Os   AA	c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  oBaseEventLoopWithSelectorTests.test_create_connection_happy_eyeballs_empty_exceptions.<locals>.getaddrinfo_task  r  r   z asyncio.staggered.staggered_racec                    "   R . 3# 5ir   r   )coro_fnsr   rc   s   &&&r   	mock_racehBaseEventLoopWithSelectorTests.test_create_connection_happy_eyeballs_empty_exceptions.<locals>.mock_race  s     Rxr  r  r   )happy_eyeballs_delayzcreate_connection failedN)
rc   r  r   r5   r  r  r  r   r  r   )rE   r0   r  mock_staggeredr  r  r  s   f&    @r   6test_create_connection_happy_eyeballs_empty_exceptionsUBaseEventLoopWithSelectorTests.test_create_connection_happy_eyeballs_empty_exceptions  s    
	O	E !1		
 ZZ:;;~ )2&99.. / FD ''6PQQ		,,T2 R <; RQ <;;s$   ACB5	#C5C CC	c                    V P                   P                  \        R ^P\        4       R7      pV P	                  \
        V P                   P                  V4       R# )r  r  N)rc   r  r  rD  rl   rT  r   rE   r  s   & r   %test_create_connection_host_port_sockDBaseEventLoopWithSelectorTests.test_create_connection_host_port_sock  sB    yy**]BVX + 7*dii&B&BDIr   c           	        \         P                   ! \         P                  \         P                  4      pT;_uu_ 4        V P                  P	                  \
        VR 7      pV P                  \        R4      ;_uu_ 4        V P                  P                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir  zA Stream Socket was expectedN)	r(   r   r#   rc   r  r  r   rT  r   rE   r  r  s   &  r   !test_create_connection_wrong_sock@BaseEventLoopWithSelectorTests.test_create_connection_wrong_sock  s    }}V^^V->->?T99..wT.BD''
(FH H		,,T2H TH H TT$   A B?>B,	B?,B<7B??C	c           	        \         P                   ! \         P                  \         P                  4      pT;_uu_ 4        V P                  P	                  \
        VR 7      pV P                  \        R4      ;_uu_ 4        V P                  P                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir  )	r(   r   r#   rc   create_serverr  r   rT  r   r  s   &  r   test_create_server_wrong_sock<BaseEventLoopWithSelectorTests.test_create_server_wrong_sock  s    }}V^^V->->?T99**7*>D''
(FH H		,,T2H TH H TTr  c                    V P                   P                  \        R ^P^R7      pV P                  \        R4      ;_uu_ 4        V P                   P                  V4       RRR4       R#   + '       g   i     R# ; ir  )ssl_handshake_timeoutz1ssl_handshake_timeout is only meaningful with sslN)rc   r  r  r   rT  r   r  s   & r   /test_create_server_ssl_timeout_for_plain_socketNBaseEventLoopWithSelectorTests.test_create_server_ssl_timeout_for_plain_socket  sm    yy&&]Ba ' A##CE E II((.E E E E   A((A9	SOCK_NONBLOCKz$no socket.SOCK_NONBLOCK (linux only)c                   \         P                   ! \         P                  \         P                  \         P                  ,          4      pV;_uu_ 4        V P                  P                  R  VR7      pV P                  P                  V4      pVP                  4        V P                  P                  VP                  4       4       RRR4       R#   + '       g   i     R# ; i)c                      R # r   r   r   r   r   r   RBaseEventLoopWithSelectorTests.test_create_server_stream_bittype.<locals>.<lambda>  s    4r   r  N)	r(   r   r"   r(  rc   r  r   r~   wait_closed)rE   r  r  srvs   &   r   !test_create_server_stream_bittype@BaseEventLoopWithSelectorTests.test_create_server_stream_bittype  s     }}NNF..1E1EEGT99**<d*CD))..t4CIIKII(():;	 TTTs   A3CC!	zno IPv6 supportc                  a  V 3R  lp S P                   P                  V! 4       4       R#   \         dS   p\        \        R4      '       d7   TP                  \        P
                  8X  d   S P                  R4        Rp?R# h Rp?ii ; i)c                  R  <"   \         P                  ! R  R^ 4      G Rj  xL
 p  SP                  \        V P                  4      ^ 4       V P                  4        V P                  4       G Rj  xL
  R#  LT L  T P                  4        T P                  4       G Rj  xL 
  i ; i5i)c                      R # r   r   r   r   r   r   VBaseEventLoopWithSelectorTests.test_create_server_ipv6.<locals>.main.<locals>.<lambda>  s    Tr   r  N)r   start_serverassertGreaterr?  socketsr~   r,  )r-  rE   s    r   mainDBaseEventLoopWithSelectorTests.test_create_server_ipv6.<locals>.main  s{     ,,\5!DDC(""3s{{#3Q7		oo''' E
 ( 		oo'''sD   B'A5B'%A9 #B'.A7/B'7B'9$B$B B$$B'EADDRNOTAVAILzfailed to bind to ::1N)rc   r   r  r)   errnor9  skipTest)rE   r7  exs   f  r   test_create_server_ipv66BaseEventLoopWithSelectorTests.test_create_server_ipv6  sc    	(	II((0 	//HH 3 33566	s    + BABBBc           	        \         P                   ! \         P                  4      pT;_uu_ 4        V P                  P                  \        VR 7      pV P                  \        R4      ;_uu_ 4        V P                  P                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  zA datagram socket was expectedN)r(   r   rc   create_datagram_endpointr  r   rT  r   r  s   &  r   (test_create_datagram_endpoint_wrong_sockGBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_wrong_sock  s    }}V^^,T9955gD5ID''
(HJ J		,,T2J TJ J TTs$   A B0/B	B0B-(B00C	c                    V P                   P                  \        4      pV P                  \        V P                   P
                  V4       R # r   rc   r  r  rl   rT  r   r  s   & r   (test_create_connection_no_host_port_sockGBaseEventLoopWithSelectorTests.test_create_connection_no_host_port_sock  s2    yy**73*dii&B&BDIr   c                   a a R  oVV 3R lpVS P                   n        S P                   P                  \        R^P4      pS P	                  \
        S P                   P                  V4       R# )c                     "   . # 5ir   r   r  s   *,r   r  YBaseEventLoopWithSelectorTests.test_create_connection_no_getaddrinfo.<locals>.getaddrinfo  s
     Ir  c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  ^BaseEventLoopWithSelectorTests.test_create_connection_no_getaddrinfo.<locals>.getaddrinfo_task  r  r   r  N)rc   r  r  r  rl   r  r   rE   r  r  r  s   f  @r   %test_create_connection_no_getaddrinfoDBaseEventLoopWithSelectorTests.test_create_connection_no_getaddrinfo  sS    		E !1		yy**7M2FTYY114	9r   c                L  a a R  oVV 3R lpVS P                   n        \        P                  ! 4       S P                   n        \
        S P                   P                  n        S P                   P                  \        R^P4      pS P                  \
        S P                   P                  V4       S P                   P                  \        R^PRR7      pS P                  \        4      ;_uu_ 4       pS P                   P                  V4       RRR4       S P                  XP                  \        4       S P                  \        VP                  P                   4      ^4       S P                  VP                  P                   ^ ,          \
        4       R#   + '       g   i     L; i)c                     "   R.# 5ir  r   r  s   *,r   r  VBaseEventLoopWithSelectorTests.test_create_connection_connect_err.<locals>.getaddrinfo       788   c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  [BaseEventLoopWithSelectorTests.test_create_connection_connect_err.<locals>.getaddrinfo_task"  r  r   r  Tr  N)rc   r  r   rd   r   r  r  r  r  rl   r   r  r   r  rA   r?  r  )rE   r  r  r  r  s   f   @r   "test_create_connection_connect_errABaseEventLoopWithSelectorTests.test_create_connection_connect_err  s   	9	E !1		!%		-4		*yy**7M2FTYY114	9 yy**7M2RV*W~.."II((. / 	bllN;R\\445q9bll55a8'B /.s   -FF#	c                n  a a R  oVV 3R lpVS P                   n        \        P                  ! 4       S P                   n        \
        S P                   P                  n        \        P                  ! 4       pW1P                  n        \        VP                  n        S P                   P                  \        R^P4      pS P                  \
        S P                   P                  V4       S P                   P                  \        R^PRR7      pS P                  \
        S P                   P                  V4       R# )c                     "   R.# 5ir  r   r  s   *,r   r  gBaseEventLoopWithSelectorTests.test_create_connection_connect_non_os_err_close_err.<locals>.getaddrinfo9  rR  rS  c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  lBaseEventLoopWithSelectorTests.test_create_connection_connect_non_os_err_close_err.<locals>.getaddrinfo_task<  r  r   r  Tr  N)rc   r  r   rd   r   r   r  r(   r/   r  r~   r  r  rl   r   )rE   r0   r  r  r  r  s   f&   @r   3test_create_connection_connect_non_os_err_close_errRBaseEventLoopWithSelectorTests.test_create_connection_connect_non_os_err_close_err5  s    	9	E !1		!%		-8		*yy{'+$!(

yy**7M2F55t	= yy**7M2RV*W55t	=r   c                  a a R  oVV 3R lpVS P                   n        \        P                  ! 4       S P                   n        \
        S P                   P                  n        S P                   P                  \        R^P\        P                  R7      pS P                  \
        4      ;_uu_ 4        S P                   P                  V4       RRR4       S P                   P                  \        R^P\        P                  RR7      pS P                  \        4      ;_uu_ 4       pS P                   P                  V4       RRR4       S P                  XP                  \        4       VP                  P                    F  pS P                  V\
        4       K  	  R#   + '       g   i     L; i  + '       g   i     Lx; i)c                     "   RR.# 5ir  )r  r?   r  r;   )0.0.0.1r  )r  r?   r  r;   )z0.0.0.2r  r   r  s   *,r   r  SBaseEventLoopWithSelectorTests.test_create_connection_multiple.<locals>.getaddrinfoO       224 4r  c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  XBaseEventLoopWithSelectorTests.test_create_connection_multiple.<locals>.getaddrinfo_taskS  r  r   r  familyNT)rh  r  )rc   r  r   rd   r   r  r  r  r  r(   r   rl   r   r  r   r  r  )rE   r  r  r  r  r  s   f    @r   test_create_connection_multiple>BaseEventLoopWithSelectorTests.test_create_connection_multipleN  s/   	4	E !1		!%		-4		*yy**]Bv~~ + ?w''II((. ( yy**]Bv~~$ + P~.."II((. / 	bllN;((A!!!W- ) ('
 /.s   /F"F.F+	.F>	c           	       a a R  pW!P                   P                  n        R oVV 3R lpVS P                  n        \
        P                  ! 4       S P                  n        \        R4      S P                  P                  n	        S P                  P                  \        R^P\         P                  R
R7      pS P                  \        4      ;_uu_ 4       pS P                  P                  V4       RRR4       S P                  \!        XP"                  4      R4       S P%                  VP                   P                  P&                  P(                  4       S P                  P                  \        R^P\         P                  R
RR	7      pS P                  \*        4      ;_uu_ 4       pS P                  P                  V4       RRR4       S P-                  VP"                  \*        4       VP"                  P.                   F  pS P-                  V\        4       K  	  R#   + '       g   i     EL8; i  + '       g   i     Ly; i)c                 J    V ^ ,          R8X  d   \        R4      pRVn        VhR# )r@   rb  ErrN)r  strerror)r  errs   & r   bind^BaseEventLoopWithSelectorTests.test_create_connection_multiple_errors_local_addr.<locals>.bindk  s(    Aw)#en$	 $r   c                     "   RR.# 5ira  r   r  s   *,r   r  eBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors_local_addr.<locals>.getaddrinfos  rd  r  c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  jBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors_local_addr.<locals>.getaddrinfo_taskw  r  r   Err2r  Nrh  
local_addrzMultiple exceptions: T)rh  rx  r  Ni  )r(   r/   rp  rc   r  r   rd   r   r  r  r  r  r   rl   r   assertStartsWithr  r  r   r~   r"  r  r   r  )rE   r0   rp  r  r  r  r  r  s   f&     @r   1test_create_connection_multiple_errors_local_addrPBaseEventLoopWithSelectorTests.test_create_connection_multiple_errors_local_addrh  s   	 -1$$)	4	E !1		!%		-4V_		*yy**]Bv~~# + % w''2II((. ( 	c",,/1HI44::AAByy**]Bv~~# + 6 ~.."II((. / 	bllN;((A!!!W- ) ('' /.s   H$H1H.	1I	c                ^   V'       g   V= \        P                  Vn        VP                  P                  p\        P
                  ! 4       V P                  n        \        P
                  ! 4       V P                  n        V P                  P                  \        P                  R ^P4      pV P                  P                  V4      w  rV VP                  P                  R4       VP                  P                  w  rxV P!                  VR,          VP"                  4       V P!                  VR,          VP$                  4       VP'                  4        \(        P*                  ! V P                  4       \,        P.                  '       Ed=   \        P0                  Vn        V P                  P                  \        P                  R^P4      pV P                  P                  V4      w  rV VP                  P                  ^ ,          w  p	V	R,          w  rV P5                  V
R4       V P!                  V^P4       VP                  P                  w  rxV P!                  VR,          VP0                  4       V P!                  VR,          VP$                  4       VP'                  4        \(        P*                  ! V P                  4       R# R#   TP'                  4        \(        P*                  ! T P                  4       i ; i  TP'                  4        \(        P*                  ! T P                  4       i ; i)r<   rh  r  r  :Nr  Nz	::(0\.)*1Nr<   r  )r&   r(   r  r/   r   rd   rc   _add_reader_add_writerr  r   r  r   connectr  r!  rA   r   r"   r~   r-   r   r	   rD   r   rh  assertRegex)rE   r0   allow_inet_ptonr  r  r%  p_r   addresshostports   &&&         r   _test_create_connection_ip_addr>BaseEventLoopWithSelectorTests._test_create_connection_ip_addr  s.   "%11++ $				 $				yy**7+;+;YKyy++D1	.LL++O< 11IAVH-x/?/?@VF^X-A-ABGGI""499-%%% //DK99..w/?/?KD99//5DA2 !LL2215	$R[
  |4  r*$OO55	  !183D3DE  1E1EF	&&tyy1# & GGI""499-$ 	&&tyy1s   A9K %B,K: 2K7:2L,aixzDbpo-25545: IPv6 scope id and getaddrinfo() behave differently on AIXc                d   \         P                  Vn        VP                   P                  p\         P                  Vn        \
        P                  ! 4       V P                  n        \
        P                  ! 4       V P                  n	        V P                  P                  \        P                  R ^P4      pV P                  P                  V4      w  rE VP                  P                  R4       VP                   P                   w  rgV P#                  VR,          VP                  4       V P#                  VR,          VP$                  4       VP'                  4        \(        P*                  ! V P                  4       R#   TP'                  4        \(        P*                  ! T P                  4       i ; i)z	fe80::1%1rh  r  N)zfe80::1r  r@   r?   )r(   r  r/   r   rh  r   rd   rc   r  r  r  r   r  r   r  r  r!  rA   r"   r~   r-   r   )rE   r0   r  r  r%  r  r  r   s   &&      r   !test_create_connection_ipv6_scope@BaseEventLoopWithSelectorTests.test_create_connection_ipv6_scope  s   
  &11++oo $				 $				yy**7+;+;["Myy++D1	.LL++,AB 11IAVH-x/@/@AVF^X-A-ABGGI""499- GGI""499-s   A9E= =2F/c                *    V P                  VR 4       R# r}  r  rV   s   &&r   test_create_connection_ip_addr=BaseEventLoopWithSelectorTests.test_create_connection_ip_addr  s    ,,Xt<r   c                *    V P                  VR 4       R# r  r  rV   s   &&r   #test_create_connection_no_inet_ptonBBaseEventLoopWithSelectorTests.test_create_connection_no_inet_pton  s    ,,Xu=r   z9Issue gh-71123: this fails on Android before API level 23c                f   \         P                  Vn        VP                   P                  p\        P                  ! 4       V P
                  n        \        P                  ! 4       V P
                  n        R F  w  r4V P
                  P                  \        P                  RV4      pV P
                  P                  V4      w  rg VP                  P                  RV34       VP                   P                  w  rV P                  V	R,          VP                   4       V P                  V	R,          VP"                  4       VP%                  4        \&        P(                  ! V P
                  4       K  	  R Fo  pV P
                  P                  \        P                  RV4      pV P+                  \,        4      ;_uu_ 4        V P
                  P                  V4       RRR4       Kq  	  R#   TP%                  4        \&        P(                  ! T P
                  4       i ; i  + '       g   i     K  ; i)httpr  rh  r  N))r  r  )s   httpr  )nonsenses   nonsense)r(   r  r/   r   rd   rc   r  r  r  r   r  r   r  r  r!  rA   r   r"   r~   r-   r   rl   r  )
rE   r0   r  servicer  r  r%  r  r  r   s
   &&        r   #test_create_connection_service_nameBBaseEventLoopWithSelectorTests.test_create_connection_service_name  s     &11++ $				 $				8MG99..w/?/?/:GED 99//5DA2//d0CD$OO55	  !183C3CD  1E1EF	&&tyy1 9 /G99..w/?/?/:GED ""7++		,,T2 ,+	 / 	&&tyy1 ,++s   A;G* H*2HH0c                   a a R  oVV 3R lpVS P                   n        S P                   P                  \        R^P\        P
                  RR7      pS P                  \        S P                   P                  V4       R# )c                 $   "   V R 8X  d   RR.# . # 5i)r  r  r   )r  r   r  s   &*,r   r  XBaseEventLoopWithSelectorTests.test_create_connection_no_local_addr.<locals>.getaddrinfo  s$     }$;;= = 	s   c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  ]BaseEventLoopWithSelectorTests.test_create_connection_no_local_addr.<locals>.getaddrinfo_task  r  r   r  Nrw  ry  )	rc   r  r  r  r(   r   rl   r  r   rL  s   f  @r   $test_create_connection_no_local_addrCBaseEventLoopWithSelectorTests.test_create_connection_no_local_addr  sd    		E 0		yy**]Bv~~# + % 	TYY114	9r   c                   a a RoVV 3R lpW!n         VP                  4       pS P                  P                  VS4      pS P                  P	                  V4       R# )00:01:02:03:04:05c                 >   < SP                  W3S4       R ^R RS^33.# )i  r;   )rA   )r  r  r   r  r  rE   s   &&*,r   r  TBaseEventLoopWithSelectorTests.test_create_connection_bluetooth.<locals>.getaddrinfo  s-    d\40!S"tQi011r   N)r  r?   )r  r(   rc   r   r   )rE   r0   r  r  r  r  s   f&   @r    test_create_connection_bluetooth?BaseEventLoopWithSelectorTests.test_create_connection_bluetooth  sK     (	2  + yy%%dD1		$$T*r   c                P  a a	 \         P                  ! 4       S P                  n        V 3R  lpVS P                  P                  n        \         P                  ! 4       S P                  n        S P                  P                  4       S P                  P
                  n        S P                  P
                  P                  P                  R4       \         P                  ! 4       S P                  n	         ! R R4      o	V	3R lpVS P                  P                  n        \         P                  p\        4       p\        4       pS P                  P                  P                  4        S P                  P                  \        R^PRVVR7      pS P                  P                  V4      w  rxVP!                  4        S P                  P                  P#                  W3W3RRVVR	7       S P                  P                  P                  4        S P                  P                  \        R^PRR
VVR7      pS P                  P                  V4      w  rxVP!                  4        S P                  P                  P#                  W3W3RR
VVR	7       S P                  P                  P                  4        S P                  P                  \        R^PRRVVR7      pS P                  P                  V4      w  rxVP!                  4        S P                  P                  P#                  W3W3RRVVR	7       R# )c                     < SP                   P                  4       pVP                  \        P                  \        P
                  \        P                  R R3.4       V# )r;   r~  )rc   r   r  r(   r   r"   SOL_TCP)r   r  r6   rE   s   *, r   mock_getaddrinfokBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default.<locals>.mock_getaddrinfo  sL    		'')ALL6>>6+=+=!>>2@ A BHr   Nc                   0   a  ] tR tRt o RtR tR tRtV tR# )qBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default.<locals>._SelectorTransportMocki*  Nc                ,    \         P                  ! 4       # r   )r   rd   )rE   keys   &&r   get_extra_infoڀBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default.<locals>._SelectorTransportMock.get_extra_info-  s    yy{"r   c                :    V P                   P                  4        R # r   )_sockr~   r   s   &r   r~   wBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default.<locals>._SelectorTransportMock.close0  s    

  "r   r   )	r   r   r   r   r  r  r~   r   rY   rZ   s   @r   _SelectorTransportMockr  *  s     E## #r   r  c                 D   < VP                  R 4       S! 4       pWn        V# r   )r  r  )r  protocol
sslcontextwaiterr  r  r  s   &&&&, r   mock_make_ssl_transportrBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default.<locals>.mock_make_ssl_transport3  s$    d#.0I"Or   
python.orgT)sslr$  ssl_shutdown_timeoutF)server_sideserver_hostnamer$  r  zperl.com)r  r  r$  r  r;   )r   rd   rc   r  r  r   r   r/   r  ro   ANYrD  r  r  r  r   r~   r  )
rE   r  r  r  handshake_timeoutshutdown_timeoutr  r  r  r  s
   f        @r   2test_create_connection_ssl_server_hostname_defaultQBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_default  s    $					 -=		)!%		.2ii.E.E.G		+		++66t<(,				%	# 	#	 5L		%%1hh"H!8		%%002yy**rt&7%5 + 7 yy33D9			%%88c("3!1 	9 	3 			%%002yy**rt *&7%5	 + 7
 yy33D9			%%88c&"3!1 	9 	3 			%%002yy**rt "&7%5	 + 7
 yy33D9			%%88#! "&7%5 	9 	7r   c                >   V P                   P                  \        R ^PRR7      pV P                  \        V P                   P
                  V4       V P                   P                  \        R ^PR R7      pV P                  \        V P                   P
                  V4       R# )r  r;   )r  NrD  r  s   & r   4test_create_connection_no_ssl_server_hostname_errorsSBaseEventLoopWithSelectorTests.test_create_connection_no_ssl_server_hostname_errorsk  s    yy**7L";= + ?*dii&B&BDIyy**7L";G + I*dii&B&BDIr   c                <   V P                   P                  \        R ^PRR7      pV P                  \        V P                   P
                  V4       V P                   P                  \        R^PRR7      pV P                  \        V P                   P
                  V4       \        P                  ! 4       pV P                   P                  \        RRRVR7      pV P                  VP                  4       V P                  \        V P                   P
                  V4       R# )r;   T)r  N)r  r  )	rc   r  r  rl   rT  r   r(   rS  r~   )rE   r  r  s   &  r   1test_create_connection_ssl_server_hostname_errorsPBaseEventLoopWithSelectorTests.test_create_connection_ssl_server_hostname_errorst  s    yy**7B*E*dii&B&BDIyy**7D"$*G*dii&B&BDI}}yy**7D$/3$ + @

#*dii&B&BDIr   c                    V P                   P                  \        R ^P^R7      pV P                  \        R4      ;_uu_ 4        V P                   P                  V4       RRR4       R#   + '       g   i     R# ; ir#  )rc   r  r  r   rT  r   r  s   & r   3test_create_connection_ssl_timeout_for_plain_socketRBaseEventLoopWithSelectorTests.test_create_connection_ssl_timeout_for_plain_socket  sm    yy**]Ba + A##CE E II((.E E E Er'  c                  a aa \        4       oV3R  loVV 3R lpVS P                  n        S P                  P                  \        R^ 4      pS P                  \        S P                  P                  V4       S P                  S4       R# )c                  "   <"   V ^ ,          o. # 5i)r@   r   )r   r  r  s   *,r   r  QBaseEventLoopWithSelectorTests.test_create_server_empty_host.<locals>.getaddrinfo  s     7DIs   c                  F   < SP                   P                  S! V / VB 4      # r   r  r  s   *,r   r  VBaseEventLoopWithSelectorTests.test_create_server_empty_host.<locals>.getaddrinfo_task  r  r   r;   N)	rD  rc   r  r  r  rl   r  r   rC   )rE   r  r  r  r  s   f  @@r   test_create_server_empty_host<BaseEventLoopWithSelectorTests.test_create_server_empty_host  se    x	
	E !1		ii%%gr15'499#?#?E$r   c                    V P                   P                  \        R ^ \        4       R7      pV P	                  \
        V P                   P                  V4       R# )0.0.0.0r  N)rc   r  r  rD  rl   rT  r   rE   r  s   & r   !test_create_server_host_port_sock@BaseEventLoopWithSelectorTests.test_create_server_host_port_sock  sB    ii%%Y & 2*dii&B&BCHr   c                    V P                   P                  \        4      pV P                  \        V P                   P
                  V4       R # r   )rc   r  r  rl   rT  r   r  s   & r   $test_create_server_no_host_port_sockCBaseEventLoopWithSelectorTests.test_create_server_no_host_port_sock  s2    ii%%g.*dii&B&BCHr   c                \   \         P                  ! 4       ;qP                  n        V P                  P	                  4       Vn        VP
                  P                  R 4       V P                  P                  \        R^ 4      pV P                  \        V P                  P                  V4       R # )Nr  )r   rd   rc   r  r   r/   r  r  r  rl   r  r   )rE   r  r6   s   &  r   !test_create_server_no_getaddrinfo@BaseEventLoopWithSelectorTests.test_create_server_no_getaddrinfo  st    .2iik9ii+#'99#:#:#<   ++D1II##G\1='499#?#?Cr   c                   \         P                  Vn        V=\        P                  ! 4       VP                   n        V P                  P                  \        R ^ RR7      pV P                  \        V P                  P                  V4       R# )r  T
reuse_portN)r(   r  SO_REUSEPORTr   rd   r/   rc   r  r  rl   rT  r   rE   r0   r6   s   && r    test_create_server_nosoreuseport?BaseEventLoopWithSelectorTests.test_create_server_nosoreuseport  sh    %11!'+yy{$II##Yd $ 4 	*dii&B&BAFr   c                "   \         P                  Vn        \        P                  ! 4       VP                   n        RVn        V P                  P                  \        R^ RR7      pV P                  \        V P                  P                  V4       R# )r?   r  Tr  Nr   )r(   r  r   rd   r/   r  rc   r  r  rl   rT  r   r  s   && r   +test_create_server_soreuseport_only_definedJBaseEventLoopWithSelectorTests.test_create_server_soreuseport_only_defined  sj    %11'+yy{$ "II##Yd $ 4 	*dii&B&BAFr   c                    ! R  R\         4      pR.VP                  n        \        P                  ! 4       ;q1P
                  n        W#P                  n        V P                  P                  \        R^ 4      pV P                  \         V P                  P                  V4       V P                  VP                  P                  4       R# )c                       ] tR tRtRtRtR# )HBaseEventLoopWithSelectorTests.test_create_server_cant_bind.<locals>.Erri  r  r   N)r   r   r   r   rn  r   r   r   r   rm  r    s    Hr   rm  r  N)r  r?   r  r;   )r  it'  )r  r  r/   r   rd   r(   rp  r  rc   r  r  rl   r   r   r~   r"  rE   r0   rm  m_sockr  s   &&   r   test_create_server_cant_bind;BaseEventLoopWithSelectorTests.test_create_server_cant_bind  s    	' 	 0-1)04		;-"%ii%%gy!<'499#?#?E++,r   c                    . VP                   n        V P                  P                  \        RR7      pV P                  \        V P                  P                  V4       R# )	localhostrx  N)r  r@   )r  r/   rc   r@  r  rl   r  r   rE   r0   r  s   && r   )test_create_datagram_endpoint_no_addrinfoHBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_no_addrinfo  sN    ,.)yy11(8 2 :TYY114	9r   c                6   V P                   P                  \        R R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        RR7      pV P                  \        V P                   P
                  V4       R# )r  r  N)r  r?   r     )rc   r@  r  rl   r   r   r  s   & r   (test_create_datagram_endpoint_addr_errorGBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_addr_error  s~    yy11 2 5tyy33T	;yy11(> 2 @tyy33T	;r   c                8   \         P                  ! 4       V P                  n        \        V P                  P                  n        V P                  P                  \        P                  RR7      pV P                  \        V P                  P                  V4       R# )r  )remote_addrNr  r@   )r   rd   rc   r   r  r  r@  r   DatagramProtocolrl   r   r  s   & r   )test_create_datagram_endpoint_connect_errHBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_connect_err  sk    !%		-4		*yy11$$2B 2 DTYY114	9r   c                  a \        R V P                  R7      o\        P                  ! 4       ;V P                  n        p. Vn        V P                  P                  V3R lRR R7      pV P                  P                  V4      w  r4V P                  VP                  4       VP                  4        V P                  P                  SP                  4       V P                  RSP                  4       R# )Tr   rc   c                     < S # r   r   )r  s   r   r   ^BaseEventLoopWithSelectorTests.test_create_datagram_endpoint_allow_broadcast.<locals>.<lambda>  s    Hr   )r  allow_broadcastr  Nr   )r  rc   r   rd   r   r/   r@  r   r|   r"  r~   r  rA   r  )rE   r   r  r  r  r  s   &    @r   -test_create_datagram_endpoint_allow_broadcastLBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_allow_broadcast  s    "DIIF04		;		$&!yy11(  2 "
 yy33D9	,,-		$$X]]38>>2r   c                   \         P                  Vn        \        VP                   n        V P                  P                  \        P                  \         P                  R 7      pV P                  \        V P                  P                  V4       V P                  P                  \        P                  RR7      pV P                  \        V P                  P                  V4       R# )rg  r  Nr   )r(   r  r  r  rc   r@  r   r  r   rl   r   r  s   && r   (test_create_datagram_endpoint_socket_errGBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_socket_err  s    %11&-#yy11$$V^^ 2 =TYY114	9 yy11$$1A 2 CTYY114	9r   zIPv6 not supported or enabledc                    V P                   P                  \        P                  RRR7      pV P	                  \
        V P                   P                  V4       R# )r  )r  rx  Nr   )r  r@   rc   r@  r   r  rl   rT  r   r  s   & r   0test_create_datagram_endpoint_no_matching_familyOBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_no_matching_family  sK    yy11$$(Z 2 A 			44d	<r   c                   \         VP                  P                  P                  n        V P
                  P                  \        P                  \        P                  R 7      pV P                  \         V P
                  P                  V4       V P                  VP                  P                  P                  P                  4       R# )rg  N)r  r(   r/   setblockingr  rc   r@  r   r  r   rl   r   r   r~   r"  r  s   && r   (test_create_datagram_endpoint_setblk_errGBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_setblk_err  s    ?F$$00<yy11$$V^^ 2 =TYY114	9OO((..55	7r   c                    V P                   P                  \        P                  4      pV P	                  \
        V P                   P                  V4       R # r   r  r  s   & r   -test_create_datagram_endpoint_noaddr_nofamilyLBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_noaddr_nofamily  s;    yy11$$&*dii&B&BDIr   c                    ! R  R\         4      p\        P                  Vn        \        P                  ! 4       ;q1P                  n        W#P                  n        V P                  P                  \        R\        P                  R7      pV P                  W P                  P                  V4       V P                  VP                  P                   4       R# )c                       ] tR tRtRtR# )SBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_cant_bind.<locals>.Erri%  r   Nr   r   r   r   rm  r  %  r]  r   rm  )rx  rh  Nr   )r  r(   r  r   rd   r/   rp  r  rc   r@  r  r   rl   r   r   r~   r"  r  s   &&   r   'test_create_datagram_endpoint_cant_bindFBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_cant_bind#  s    	' 	  &1104		;-"%ii00' 1 @ 	#yy;;SA++,r   c                  a  \         P                   ! \         P                  \         P                  4      pVP                  R4       S P                  P                  V 3R lVR7      pS P                  P                  V4      w  r4VP                  4        S P                  P                  VP                  4       S P                  RVP                  4       R# )r  c                  2   < \        R S P                  R7      # Tr  r  rc   r   s   r   r   SBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock.<locals>.<lambda>6      O$TYYGr   r  r  Nr   )r(   r   r#   rp  rc   r@  r   r~   r  rA   r  )rE   r  r  r  r  s   f    r   "test_create_datagram_endpoint_sockABaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock2  s    }}V^^V->->?		"#ii00G 1  #ii::3?			$$X]]38>>2r   AF_UNIXzNo UNIX Socketsc                  a  S P                   P                  V 3R  l\        P                  R7      pS P                   P	                  V4      w  r#S P                  VP                  P                  \        P                  4       VP                  4        S P                   P	                  VP                  4       S P                  RVP                  4       R# )c                  2   < \        R S P                  R7      # r   r!  r   s   r   r   XBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock_unix.<locals>.<lambda>@  r#  r   rg  r  N)rc   r@  r(   r&  r   rA   r  rh  r~   r  r  )rE   r  r  r  s   f   r   'test_create_datagram_endpoint_sock_unixFBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock_unix=  s    ii00G>> 1 # #ii::3?	//@		$$X]]38>>2r   c                *  a  \         P                  ! 4       ;_uu_ 4       p\        P                  ! \        P                  \        P                  R 7      pVP                  V4       VP                  4        S P                  P                  V 3R lV\        P                  R7      pS P                  P                  V4      w  rEVP                  4        S P                  P                  VP                  4       RRR4       R#   + '       g   i     R# ; i))r  c                  2   < \        R S P                  R7      # r   r!  r   s   r   r   aBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_existing_sock_unix.<locals>.<lambda>P  s    dKr   rg  N)r-   unix_socket_pathr(   r&  r#   rp  r~   rc   r@  r   r  )rE   pathr  r  r  r  s   f     r   0test_create_datagram_endpoint_existing_sock_unixOBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_existing_sock_unixH  s    ((**d==f6G6GHDIIdOJJL9955KV^^ 6 -D #'))">">t"DIOOII((7 +***s   CDD	c                    ! R  R4      pV P                   P                  \        RV! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        RV! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        ^V! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        ^V! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        ^V! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        RV! 4       R7      pV P                  \        V P                   P
                  V4       V P                   P                  \        RV! 4       R	7      pV P                  \        V P                   P
                  V4       R
# )c                   .    ] tR tRt]P
                  tRtR# )\BaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock_sockopts.<locals>.FakeSockiW  r   N)r   r   r   r   r(   r#   r  r   r   r   r   FakeSockr5  W  s    $$Dr   r6  )rx  r  )r  r  )rh  r  )protor  )flagsr  T)r  r  )r  r  Nr   )rc   r@  r  rl   rT  r   )rE   r6  r  s   &  r   +test_create_datagram_endpoint_sock_sockoptsJBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sock_sockoptsV  s   	% 	% ii00(8xz 1 K*dii&B&BCHii00)9
 1 L*dii&B&BCHii00AHJ 1 8*dii&B&BCHii0018: 1 7*dii&B&BCHii0018: 1 7*dii&B&BCHii008: 1 ?*dii&B&BCHii00T
 1 D*dii&B&BCHr   vxworksz-SO_BROADCAST is enabled by default on VxWorksc                .  a  S P                   P                  V 3R  lR	R7      pS P                   P                  V4      w  r#VP                  R4      p\	        \
        R4      pV'       d>   S P                  VP                  \
        P                  \
        P                  4      4       S P                  VP                  \
        P                  \
        P                  4      4       VP                  4        S P                   P                  VP                  4       S P                  RVP                  4       S P                   P                  V 3R lR	VRR7      pS P                   P                  V4      w  r#VP                  R4      pS P                  VP                  \
        P                  \
        P                  4      4       V'       d>   S P!                  VP                  \
        P                  \
        P                  4      4       S P!                  VP                  \
        P                  \
        P                  4      4       VP                  4        S P                   P                  VP                  4       S P                  RVP                  4       R# )
c                  2   < \        R S P                  R7      # r   r!  r   s   r   r   WBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sockopts.<locals>.<lambda>}  r#  r   r  r(   r  r  c                  2   < \        R S P                  R7      # r   r!  r   s   r   r   r>    r#  r   T)rx  r  r  Nr   )rc   r@  r   r  r)   r(   r|   
getsockoptr$   r  SO_BROADCASTr~   r  rA   r  r%   r   )rE   r  r  r  r  reuseport_supporteds   f     r   &test_create_datagram_endpoint_sockoptsEBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_sockoptsv  s    yy11G' 2 ) #ii::4@	''1%fn=%%v':':<= 	OO!!6#6#68	9 			$$X]]38>>2yy11G'* 	 2 "
 #ii::4@	''1OO!!6#6#68	9 OO%%v':':<= 	OO!!6#6#68	9 			$$X]]38>>2r   c                   a  V= \        P                  ! 4       VP                  n        S P
                  P                  V 3R  lRRR7      pS P                  \        S P
                  P                  V4       R# )c                  0   < \        S P                  R 7      # r  r!  r   s   r   r   \BaseEventLoopWithSelectorTests.test_create_datagram_endpoint_nosoreuseport.<locals>.<lambda>      O3r   Trx  r  Nr   )
r  r   rd   r(   r/   rc   r@  rl   rT  r   r  s   f& r   +test_create_datagram_endpoint_nosoreuseportJBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_nosoreuseport  s[    !'+yy{$yy113' 2 
 	*dii&B&BDIr   c                  a  V 3R  lpW!n         \        P                  ! 4       ;VP                  P                  n        p\        P                  ! 4       S P                  n        \        \        R4      pS P                  P                  V 3R lRVR7      pS P                  P                  V4      w  rg VP                  R4       VP                  P                  VP                  VP                  VP                  R7       VP                  4        \         P"                  ! S P                  4       R#   TP                  4        \         P"                  ! S P                  4       i ; i)c                  *   < SP                  R 4       R# )z"should not have called getaddrinfoN)fail)r   r  rE   s   *,r   r  YBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_ip_addr.<locals>.getaddrinfo  s    II:;r   r  c                  0   < \        S P                  R 7      # r  r!  r   s   r   r   VBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_ip_addr.<locals>.<lambda>  rH  r   rI  )rh  r7  r  NrR   )r  r   rd   r(   r/   rp  rc   r  r)   r@  r   r  r   r!   r#   r~   r-   r   )rE   r0   r  rp  rB  r  r%  r  s   f&      r   %test_create_datagram_endpoint_ip_addrDBaseEventLoopWithSelectorTests.test_create_datagram_endpoint_ip_addr  s   	<  +3799;>$$)D $				%fn=yy113%* 2 ,
 yy++D1	.##N3OO..h6F6F5=5I5I4<4G4G / I GGI""499- GGI""499-s   2AD1 12E#c                    \         P                  ! 4       p\        4       VP                  n        V P
                  P                  \        V4       V P                  VP                  P                  4       R # r   )r   rd   BlockingIOErroracceptr  rc   _accept_connectionr  r|   r~   r"  rE   r  s   & r   test_accept_connection_retry;BaseEventLoopWithSelectorTests.test_accept_connection_retry  sH    yy{"1"3		$$Wd3**+r   r  c                @   \         P                  ! 4       p^
VP                  n        \	        \
        P                  R4      VP                  n        \         P                  ! 4       V P                  n
        \         P                  ! 4       V P                  n        V P                  P                  \        V4       V P                  VP                  P                   4       V P#                  VP$                  P                   4       V P                  P                  P'                  ^
4       V P                  P                  P'                  \(        P*                  \         P,                  \        VRR\         P,                  \         P,                  \         P,                  4	       R# )
   zToo many open filesN)r   rd   filenor/   r  r:  EMFILErV  r  rc   _remove_readerr   rW  r  r   r  r"  r|   r~   r  r   ACCEPT_RETRY_DELAYr  )rE   m_logr  s   && r    test_accept_connection_exception?BaseEventLoopWithSelectorTests.test_accept_connection_exception  s    yy{#% ")%,,8M"N#'99;		 #yy{				$$Wd3**+**+		  33B7		//((HHT4txx488		Er   c           	     h   R  pV P                   P                  R4       TpV! 4       pV P                  VP                  4       W#3 EF  pV P	                  \
        4      ;_uu_ 4        V P                   P                  V4       RRR4       V P	                  \
        4      ;_uu_ 4        V P                   P                  V4       RRR4       V P	                  \
        4      ;_uu_ 4        V P                   P                  ^<V4       RRR4       V P	                  \
        4      ;_uu_ 4        V P                   P                  V P                   P                  4       ^<,           V4       RRR4       V P	                  \
        4      ;_uu_ 4        V P                   P                  V P                   P                  RV4      4       RRR4       EK  	  R#   + '       g   i     ELW; i  + '       g   i     EL*; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     EK  ; i)c                     "   R # 5ir   r   r   r   r   simple_coroutineLBaseEventLoopWithSelectorTests.test_call_coroutine.<locals>.simple_coroutine  r  r  TN)rc   r   rS  r~   rl   r   r   r  r   r   r   r   r  )rE   rf  	coro_funccoro_objr1  s   &    r   test_call_coroutine2BaseEventLoopWithSelectorTests.test_call_coroutine  sc   	 			D!$	;')D""9--		##D) .""9--		..t4 .""9--		$$R. .""9--		!!$)).."2R"7> .""9--		,,II--dD9; .- *-------------s<   'G(G%)G9+<H6HG"%G69H	HH1c                   R  pR p\         P                  ! V P                  4       V P                  P                  R4       RV P                  n        V P                  P                  W P                  4       V P                  P                  4        VP                  P                  ^ ,          vrEV P                  V\        V4      ,          R4       \         P                  ! V! V P                  4      V P                  R7       V P                  P                  4        VP                  P                  ^ ,          vrEV P                  V\        V4      ,          R4       R# )c                 &    V P                  4        R # r   r   r  s   &r   stop_loop_cbLBaseEventLoopWithSelectorTests.test_log_slow_callbacks.<locals>.stop_loop_cb  s    IIKr   c                 .   "   V P                  4        R # 5ir   rn  r  s   &r   stop_loop_coroNBaseEventLoopWithSelectorTests.test_log_slow_callbacks.<locals>.stop_loop_coro  s     IIK   Tg        z4^Executing <Handle.*stop_loop_cb.*> took .* seconds$r  z4^Executing <Task.*stop_loop_coro.*> took .* seconds$N)r   rg   rc   r   slow_callback_durationr   r   warningr!  r  tupler  )rE   m_loggerro  rr  fmtr   s   &&    r   test_log_slow_callbacks6BaseEventLoopWithSelectorTests.test_log_slow_callbacks  s   		 	tyy)		D!+.		( 			L))4		%%//2
uT{*,	-
 	nTYY7diiH		%%//2
uT{*,	-r   r  )Qr   r   r   r   ra   r   r5   r  r7   r  r  r  r  r  r   r%  unittest
skipUnlessr)   r(   r.  r	   rD   r=  rA  rE  rM  rV  r]  ri  r{  r  skipIfrp  platform
startswithr  r  r  r   
is_androidandroid_ver	api_levelr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r$  r*  skip_unless_bind_unix_socketr1  r9  rC  rJ  rR  rY  rb  rj  rz  r   rY   r  r  s   @@r   r  r  c  s    '
 
ZZ$%  & 
 %. %.N / /( 3 3:J
33/ 9?A<A< 335FG H$3J
9C. = =0.4 &. &.P'2R 335FG__S\\,,U3Z\. \ H.& = = > > __DDx335??"DC3	 
389$ + +N7`J
J/ "I
ID G G G G - - 9 9;93" 9 9 335TU< V< 7 7J
 - -	3 35FG3 H3 //8 08I@ __S\\Y.CE-3E-3^ 	J 	J . .0, 
ZZ,-E .E";* 
ZZ,-- .- -r   r  c                   &   a  ] tR tRt o R tRtV tR# )RunningLoopTestsi  c                   R  p\         P                  ! 4       p\         P                  ! 4       p V P                  \        R4      ;_uu_ 4        VP	                  V! V4      4       RRR4       VP                  4        VP                  4        R#   + '       g   i     L2; i  TP                  4        TP                  4        i ; i)c                 .   "   V P                  4        R # 5ir   )r   r  s   &r   runner@RunningLoopTests.test_running_loop_within_a_loop.<locals>.runner  s     rt  zwhile another loop is runningN)r   r  r   r   r   r~   )rE   r  rc   
outer_loops   &   r   test_running_loop_within_a_loop0RunningLoopTests.test_running_loop_within_a_loop  s    	 %%'++-
	''(GI I--fTl;I JJLI I JJLs#   B" B%B" B	B" ""Cr   N)r   r   r   r   r  r   rY   rZ   s   @r   r  r    s      r   r  c                      a a ] tR tRt oRR,          t ! R R]P                  4      t]V 3R l4       t	]V 3R l4       t
V 3R ltRR ltR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tRtVtV ;t# )BaseLoopSockSendfileTestsi(     c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	!BaseLoopSockSendfileTests.MyProtoi,  c                x    R V n         R V n        \        4       V n        VP	                  4       V n        RV n        R# r  )rb  closed	bytearrayr  r   r  r  )rE   rc   s   &&r   r  *BaseLoopSockSendfileTests.MyProto.__init__.  s0     DLDK!DI))+DH!DNr   c                     R V n         Wn        R# r}  )rb  r  r  s   &&r   r  1BaseLoopSockSendfileTests.MyProto.connection_made5  s    DL&Nr   c                <    V P                   P                  V4       R # r   )r  extendr  s   &&r   r  /BaseLoopSockSendfileTests.MyProto.data_received9  s    IIT"r   c                X    R V n         V P                  P                  R4       RV n        R# r}  )r  r  r  r  r  s   &&r   r  1BaseLoopSockSendfileTests.MyProto.connection_lost<  s"    DKHH%!DNr   c                :   "   V P                   G R j  xL
  R #  L5ir   r~  r   s   &r   r,  -BaseLoopSockSendfileTests.MyProto.wait_closedA  s     ((NNs   )r  r  r  rb  r  N)r   r   r   r   r  r  r  r  r,  r   rY   rZ   s   @r   r  r  ,  s#     	"	'	#	"
	 	r   r  c                  < \         P                  V n        R\         n        \        \        P
                  R4      ;_uu_ 4       pVP                  V P                  4       RRR4       \        SV `%  4        R#   + '       g   i     L ; i)r  wbNi @  )
r   !SENDFILE_FALLBACK_READBUFFER_SIZE'_BaseLoopSockSendfileTests__old_bufsizeopenr   TESTFNr  DATAr`   
setUpClass)clsfpri   s   & r   r  $BaseLoopSockSendfileTests.setUpClassD  sW    %GG6?	3)""D))RHHSXX * *)s   A88B	c                   < V P                   \        n        \        P                  ! \        P
                  4       \        SV `  4        R # r   )r  r   r  r   unlinkr  r`   tearDownClass)r  ri   s   &r   r  'BaseLoopSockSendfileTests.tearDownClassL  s0    696G6G	3))*r   c                  < ^ RI Hp V! 4       V n        V P                  V P                  4       \	        \
        P                  R4      V n        V P                  V P                  P                  4       \        SV `-  4        R# )r@   )BaseSelectorEventLooprbN)asyncio.selector_eventsr  rc   rg   r  r   r  filerS  r~   r`   ra   )rE   r  ri   s   & r   ra   BaseLoopSockSendfileTests.setUpR  sS    A)+	DII&))40			(r   c                    \         P                   ! \         P                  \         P                  4      pVP                  V4       V P	                  VP
                  4       V# r   )r(   r   r"   r  rS  r~   )rE   blockingr  s   && r   make_socket%BaseLoopSockSendfileTests.make_socket[  s?    }}V^^V-?-?@"

#r   c                8    V P                   P                  V4      # r   )rc   r   r  s   &&r   r  "BaseLoopSockSendfileTests.run_loopa  s    yy++D11r   c           	       a aaa S P                  4       oS P                  S P                  4      oS P                  S P                  P	                  V3R  l\
        P                  ^ \        P                  R7      4      oSP                  ^ ,          P                  4       p\        ^
4       F/  p S P                  S P                  P                  SV4      4        M-	  S P                  S P                  P                  SV4      4       VV VV3R lpS P!                  V4       SS3#   \         d*    S P                  \        P                  ! R4      4        K  i ; i)c                     < S # r   r   )r7  s   r   r   3BaseLoopSockSendfileTests.prepare.<locals>.<lambda>h  s    Er   rg  g      ?c                    < SP                  4        SP                  4        S P                  e:   S P                  P                  4        SP                  S P                  4       4       SP                  SP                  4       4       R # r   )r~   r  r  r,  )r7  rE   serverr  s   r   cleanup2BaseLoopSockSendfileTests.prepare.<locals>.cleanupw  sY    LLNJJL*%%'e//12MM&,,./r   )r  r  rc   r  r  r	   HOSTr(   r   r6  getsocknamer;  r   r  r   r`  rS  )rE   r  r  r  r7  r  r  s   f   @@@r   prepare!BaseLoopSockSendfileTests.prepared  s   !TYY'tyy66=--q  7  I J~~a ,,.rAdii44T4@A
   MM$))00t<=	0 	0 	 U{'  gmmC01s   .+D&&0EEc           
        V P                  4       w  rV P                  \        P                  R 4      ;_uu_ 4        V P	                  V P
                  P                  WP                  ^ R4      4       RRR4       V P                  VP                  R4       V P                  V P                  P                  4       ^ 4       R#   + '       g   i     LX; i)sendfile is not availableNr   )r  r   r   SendfileNotAvailableErrorr  rc   _sock_sendfile_nativer  rA   r  tellrE   r  r7  s   &  r   "test__sock_sendfile_native_failure<BaseLoopSockSendfileTests.test__sock_sendfile_native_failure  s    lln##G$E$E$?A AMM$))99$		:;TC DA
 	S))1-A A   7CC	c           
        V P                  4       w  rV P                  \        P                  R 4      ;_uu_ 4        V P	                  V P
                  P                  WP                  RR7      4       RRR4       V P                  V P                  P                  4       ^ 4       V P                  VP                  R4       R#   + '       g   i     LX; i)r  F)fallbackNr   )r  r   r   r  r  rc   sock_sendfiler  rA   r  r  r  s   &  r   test_sock_sendfile_no_fallback8BaseLoopSockSendfileTests.test_sock_sendfile_no_fallback  s    lln##G$E$E$?A AMM$))11$		;@ 2 B CA
 	)1-S)A Ar  c                    V P                  4       w  rV P                  V P                  P                  WP                  4      4      pVP                  4        V P                  VP                  4       4       V P                  V\        V P                  4      4       V P                  V P                  P                  4       \        V P                  4      4       V P                  VP                  V P                  4       R # r   )r  r  rc   r  r  r~   r,  rA   r?  r  r  r  rE   r  r7  rets   &   r   test_sock_sendfile_fallback5BaseLoopSockSendfileTests.test_sock_sendfile_fallback  s    llnmmDII33D))DE

e'')*c$))n-)3tyy>:TYY/r   c                   V P                  4       w  rV P                  V P                  P                  WP                  R R4      4      pVP                  4        V P                  VP                  4       4       V P                  VR4       V P                  V P                  P                  4       R4       V P                  VP                  V P                  R,          4       R# )i  i  r9  :i  i  NN)r  r  rc   r  r  r~   r,  rA   r  r  r  r  s   &   r   ,test_sock_sendfile_fallback_offset_and_countFBaseLoopSockSendfileTests.test_sock_sendfile_fallback_offset_and_count  s    llnmmDII33D))48$@ A

e'')*d#)40TYYy%9:r   c                >   V P                   P                  R 4       V P                  R R7      pV P                  \        R4      ;_uu_ 4        V P                  V P                   P                  WP                  4      4       RRR4       R#   + '       g   i     R# ; i)T)r  zmust be non-blockingN)rc   r   r  r   rT  r  r  r  rX  s   & r   test_blocking_socket.BaseLoopSockSendfileTests.test_blocking_socket  sj    		D!.##J0FGGMM$))11$		BC HGGGs   5BB	c           
     n   V P                  4       p\        \        P                  R R7      ;_uu_ 4       pV P	                  \
        R4      ;_uu_ 4        V P                  V P                  P                  W4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zutf-8)encodingzbinary modeN)	r  r  r   r  r   rT  r  rc   r  )rE   r  r6   s   &  r   test_nonbinary_file-BaseLoopSockSendfileTests.test_nonbinary_file  st    !)""W55''
MBBdii55d>? C 65BB 655s#   B#+B	>B#B B##B4	c                   \         P                   ! \         P                  \         P                  4      pVP                  R 4       V P	                  VP
                  4       V P                  \        R4      ;_uu_ 4        V P                  V P                  P                  WP                  4      4       RRR4       R#   + '       g   i     R# ; i)Fzonly SOCK_STREAM typeN)r(   r   r#   r  rS  r~   r   rT  r  rc   r  r  rX  s   & r   test_nonstream_socket/BaseLoopSockSendfileTests.test_nonstream_socket  s}    }}V^^V->->?

###J0GHHMM$))11$		BC IHHHs   >5B==C	c           
        V P                  4       pV P                  \        R 4      ;_uu_ 4        V P                  V P                  P                  WP                  ^ R4      4       RRR4       R#   + '       g   i     R# ; i) count must be a positive integerrL  Nr  r   r   r  rc   r  r  rX  s   & r   test_notint_count+BaseLoopSockSendfileTests.test_notint_count  sf    !##I$FH HMM$))11$		1gNOH H H H   7A00B	c           
        V P                  4       pV P                  \        R 4      ;_uu_ 4        V P                  V P                  P                  WP                  ^ R4      4       RRR4       R#   + '       g   i     R# ; i)r  Nr   r  r   rT  r  rc   r  r  rX  s   & r   test_negative_count-BaseLoopSockSendfileTests.test_negative_count  sf    !##J$FH HMM$))11$		1bIJH H H Hr  c           	        V P                  4       pV P                  \        R 4      ;_uu_ 4        V P                  V P                  P                  WP                  R4      4       RRR4       R#   + '       g   i     R# ; i)%offset must be a non-negative integeroffsetNr  rX  s   & r   test_notint_offset,BaseLoopSockSendfileTests.test_notint_offset  sd    !##I$KM MMM$))11$		8LMM M M M   6A//B 	c           	        V P                  4       pV P                  \        R 4      ;_uu_ 4        V P                  V P                  P                  WP                  R4      4       RRR4       R#   + '       g   i     R# ; i)r  Nr   r  rX  s   & r   test_negative_offset.BaseLoopSockSendfileTests.test_negative_offset  sd    !##J$KM MMM$))11$		2FGM M M Mr  )r  rc   s   12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcde12345abcder   )r   r   r   r   r  r   r  r  classmethodr  r  ra   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rY   r  r  s   @@r   r  r  (  s     $D'"" 0      
2>	.	*	0
;D@DPKNH Hr   r  c                   f   a  ] tR tRt o R t]P                  ! ]! ]R4      R4      R 4       t	Rt
V tR# )TestSelectorUtilsi  c                .   VP                  \        P                  \        P                  4      pV P	                  V4       \
        P                  ! V4       VP                  \        P                  \        P                  4      pV P                  V4       R # r   )r@  r(   r    TCP_NODELAYr|   r   _set_nodelayr   )rE   r  opts   && r   check_set_nodelay#TestSelectorUtils.check_set_nodelay  sb    oof00&2D2DE  &oof00&2D2DEr   r  zneed socket.TCP_NODELAYc                   \         P                   ! \         P                  \         P                  \         P                  R 7      pV;_uu_ 4        V P	                  V4       RRR4       \         P                   ! \         P                  \         P                  \         P                  R 7      pV;_uu_ 4        VP                  R4       V P	                  V4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i))rh  r  r7  NF)r(   r   r"   r    r   r  rX  s   & r   test_set_nodelay"TestSelectorUtils.test_set_nodelay  s     }}FNN9K9K#)#5#57T""4(  }}FNN9K9K#)#5#57TU#""4( T T
 TTs   C"5#C5"C2	5D	r   N)r   r   r   r   r   r|  r}  r)   r(   r  r   rY   rZ   s   @r   r  r    s5      724
)4
)r   r  __main__).__doc__concurrent.futuresr   r:  rA  r  r(   rp  r   r   r|  r   r   r   r   test.test_asyncior   r-   r  r   test.support.script_helperr   test.supportr   r	   r  r  r  r	  r   r   r2   r7   TestCaser9   r]   r  r  r  r  r  r  r  r  r   r7  r   r   r   <module>r     s         
        1  7 " & 88	) 	0":
^HZ(( ^HBD1,, D1N'g 'D'g.. '@q-Z%8%8 q-hx(( "qH
 3 3 qHh)
++ )4 zMMO r   