8000 remove deprecation assertions from tests for asyncio.wait · python/cpython@a5c5f4a · GitHub
[go: up one dir, main page]

Skip to content

Commit a5c5f4a

Browse files
committed
remove deprecation assertions from tests for asyncio.wait
1 parent 7e35d9c commit a5c5f4a

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

Lib/test/test_asyncio/test_tasks.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,28 +3241,24 @@ async def coro():
32413241

32423242

32433243
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):
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

0 commit comments

Comments
 (0)
0