File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -3241,28 +3241,24 @@ async def coro():
32413241
32423242
32433243class WaitTests (unittest .IsolatedAsyncioTestCase ):
3244- async def test_awaitable_is_deprecated_in_wait (self ):
3245- # Remove test when passing awaitables to asyncio.wait() is removed in 3.14
3244+ async def test_wait_supports_awaitables (self ):
32463245
32473246 class ExampleAwaitable :
32483247 def __await__ (self ):
32493248 return asyncio .sleep (0 ).__await__ ()
32503249
3251- with self .assertWarnsRegex (
3252- DeprecationWarning ,
3253- "awaitable objects that are not futures" ,
3254- ):
3255- await asyncio .wait ([ExampleAwaitable ()])
3250+ await asyncio .wait ([ExampleAwaitable ()])
32563251
32573252 task = asyncio .create_task (coroutine_function ())
3258- with (
3259- self .assertWarnsRegex (
3260- DeprecationWarning , "awaitable objects that are not futures"
3261- ),
3262- self .assertRaises (TypeError ),
3253+ coro = coroutine_function ()
3254+ with self .assertRaisesRegex (
3255+ TypeError ,
3256+ r"Passing coroutines is forbidden, use tasks explicitly."
32633257 ):
3264- await asyncio .wait ([task , ExampleAwaitable (), coroutine_function () ])
3258+ await asyncio .wait ([task , ExampleAwaitable (), coro ])
32653259
3260+ # avoid: coroutine 'coroutine_function' was never awaited
3261+ coro .close ()
32663262 # avoid: Task was destroyed but it is pending!
32673263 await task
32683264
You can’t perform that action at this time.
0 commit comments