@@ -235,6 +235,11 @@ def cb():
235235 self .assertIsInstance (h , asyncio .Handle )
236236 self .assertIn (h , self .loop ._ready )
237237
238+ def test_call_soon_non_callable (self ):
239+ self .loop .set_debug (True )
240+ with self .assertRaisesRegex (TypeError , 'a callable object' ):
241+ self .loop .call_soon (1 )
242+
238243 def test_call_later (self ):
239244 def cb ():
240245 pass
@@ -341,47 +346,21 @@ def test_thread(loop, debug, create_loop=False):
341346 # check disabled if debug mode is disabled
342347 test_thread (self .loop , False , create_loop = True )
343348
344- def test_run_once_in_executor_handle (self ):
345- def cb ():
346- pass
347-
348- self .assertRaises (
349- AssertionError , self .loop .run_in_executor ,
350- None , asyncio .Handle (cb , (), self .loop ), ('' ,))
351- self .assertRaises (
352- AssertionError , self .loop .run_in_executor ,
353- None , asyncio .TimerHandle (10 , cb , (), self .loop ))
354-
355- def test_run_once_in_executor_cancelled (self ):
356- def cb ():
357- pass
358- h = asyncio .Handle (cb , (), self .loop )
359- h .cancel ()
360-
361- with self .assertWarnsRegex (DeprecationWarning , "Passing Handle" ):
362- f = self .loop .run_in_executor (None , h )
363- self .assertIsInstance (f , asyncio .Future )
364- self .assertTrue (f .done ())
365- self .assertIsNone (f .result ())
366-
367349 def test_run_once_in_executor_plain (self ):
368350 def cb ():
369351 pass
370- h = asyncio .Handle (cb , (), self .loop )
371352 f = asyncio .Future (loop = self .loop )
372353 executor = mock .Mock ()
373354 executor .submit .return_value = f
374355
375356 self .loop .set_default_executor (executor )
376357
377- with self .assertWarnsRegex (DeprecationWarning , "Passing Handle" ):
378- res = self .loop .run_in_executor (None , h )
358+ res = self .loop .run_in_executor (None , cb )
379359 self .assertIs (f , res )
380360
381361 executor = mock .Mock ()
382362 executor .submit .return_value = f
383- with self .assertWarnsRegex (DeprecationWarning , "Passing Handle" ):
384- res = self .loop .run_in_executor (executor , h )
363+ res = self .loop .run_in_executor (executor , cb )
385364 self .assertIs (f , res )
386365 self .assertTrue (executor .submit .called )
387366
0 commit comments