File tree 1 file changed +9
-13
lines changed
1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -3241,28 +3241,24 @@ async def coro():
3241
3241
3242
3242
3243
3243
class 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 ):
3246
3245
3247
3246
class ExampleAwaitable :
3248
3247
def __await__ (self ):
3249
3248
return asyncio .sleep (0 ).__await__ ()
3250
3249
3251
- with self .assertWarnsRegex (
3252
- DeprecationWarning ,
3253
- "awaitable objects that are not futures" ,
3254
- ):
3255
- await asyncio .wait ([ExampleAwaitable ()])
3250
+ await asyncio .wait ([ExampleAwaitable ()])
3256
3251
3257
3252
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."
3263
3257
):
3264
- await asyncio .wait ([task , ExampleAwaitable (), coroutine_function () ])
3258
+ await asyncio .wait ([task , ExampleAwaitable (), coro ])
3265
3259
3260
+ # avoid: coroutine 'coroutine_function' was never awaited
3261
+ coro .close ()
3266
3262
# avoid: Task was destroyed but it is pending!
3267
3263
await task
3268
3264
You can’t perform that action at this time.
0 commit comments