@@ -979,12 +979,12 @@ def test_wait_duplicate_coroutines(self):
979
979
def coro (s ):
980
980
return s
981
981
c = coro ('test' )
982
-
983
- task = self .new_task (
982
+ task = self .new_task (
984
983
self .loop ,
985
984
asyncio .wait ([c , c , coro ('spam' )]))
986
985
987
- done , pending = self .loop .run_until_complete (task )
986
+ with self .assertWarns (DeprecationWarning ):
987
+ done , pending = self .loop .run_until_complete (task )
988
988
989
989
self .assertFalse (pending )
990
990
self .assertEqual (set (f .result () for f in done ), {'test' , 'spam' })
@@ -1346,7 +1346,9 @@ def gen():
1346
1346
futs = list (asyncio .as_completed (fs , loop = loop ))
1347
1347
self .assertEqual (len (futs ), 2 )
1348
1348
waiter = asyncio .wait (futs )
1349
- done , pending = loop .run_until_complete (waiter )
1349
+ # Deprecation from passing coros in futs to asyncio.wait()
1350
+ with self .assertWarns (DeprecationWarning ):
1351
+ done , pending = loop .run_until_complete (waiter )
1350
1352
self .assertEqual (set (f .result () for f in done ), {'a' , 'b' })
1351
1353
1352
1354
def test_as_completed_duplicate_coroutines (self ):
@@ -1751,7 +1753,8 @@ async def inner():
1751
1753
1752
1754
async def outer ():
1753
1755
nonlocal proof
1754
- d , p = await asyncio .wait ([inner ()])
1756
+ with self .assertWarns (DeprecationWarning ):
1757
+ d , p = await asyncio .wait ([inner ()])
1755
1758
proof += 100
1756
1759
1757
1760
f = asyncio .ensure_future (outer (), loop = self .loop )
@@ -3307,6 +3310,17 @@ def test_loop_argument_is_deprecated_in_wait_for(self):
3307
3310
self .loop .run_until_complete (
3308
3311
asyncio .wait_for (coroutine_function (), 0.01 , loop = self .loop ))
3309
3312
3313
+ def test_coro_is_deprecated_in_wait (self ):
3314
+ # Remove test when passing coros to asyncio.wait() is removed in 3.11
3315
+ with self .assertWarns (DeprecationWarning ):
3316
+ self .loop .run_until_complete (
3317
+ asyncio .wait ([coroutine_function ()]))
3318
+
3319
+ task = self .loop .create_task (coroutine_function ())
3320
+ with self .assertWarns (DeprecationWarning ):
3321
+ self .loop .run_until_complete (
3322
+ asyncio .wait ([task , coroutine_function ()]))
3323
+
3310
3324
3311
3325
class CompatibilityTests (test_utils .TestCase ):
3312
3326
# Tests for checking a bridge between old-styled coroutines
0 commit comments