diff options
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 80afb27..6458859 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -211,7 +211,7 @@ class BaseTaskTests: with self.assertWarns(DeprecationWarning) as cm: with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'): asyncio.ensure_future(a) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) async def test(): return asyncio.ensure_future(notmuch()) @@ -226,7 +226,7 @@ class BaseTaskTests: self.addCleanup(asyncio.set_event_loop, None) with self.assertWarns(DeprecationWarning) as cm: t = asyncio.ensure_future(notmuch()) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertIs(t._loop, self.loop) self.loop.run_until_complete(t) self.assertTrue(t.done()) @@ -1449,7 +1449,7 @@ class BaseTaskTests: with self.assertWarns(DeprecationWarning) as cm: with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'): list(futs) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_as_completed_coroutine_use_running_loop(self): loop = self.new_test_loop() @@ -1881,7 +1881,7 @@ class BaseTaskTests: with self.assertWarns(DeprecationWarning) as cm: with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'): asyncio.shield(inner) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_shield_coroutine_use_running_loop(self): async def coro(): @@ -1903,7 +1903,7 @@ class BaseTaskTests: self.addCleanup(asyncio.set_event_loop, None) with self.assertWarns(DeprecationWarning) as cm: outer = asyncio.shield(coro()) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertEqual(outer._loop, self.loop) res = self.loop.run_until_complete(outer) self.assertEqual(res, 42) @@ -2911,7 +2911,7 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): with self.assertWarns(DeprecationWarning) as cm: with self.assertRaises(RuntimeError): asyncio.gather() - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_constructor_empty_sequence_use_running_loop(self): async def gather(): @@ -2929,7 +2929,7 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): self.addCleanup(asyncio.set_event_loop, None) with self.assertWarns(DeprecationWarning) as cm: fut = asyncio.gather() - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertIsInstance(fut, asyncio.Future) self.assertIs(fut._loop, self.one_loop) self._run_loop(self.one_loop) @@ -3020,7 +3020,7 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase): with self.assertWarns(DeprecationWarning) as cm: with self.assertRaises(RuntimeError): asyncio.gather(gen1, gen2) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_constructor_use_running_loop(self): async def coro(): @@ -3043,7 +3043,7 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase): gen2 = coro() with self.assertWarns(DeprecationWarning) as cm: fut = asyncio.gather(gen1, gen2) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertIs(fut._loop, self.other_loop) self.other_loop.run_until_complete(fut) |
