diff options
author | Kumar Aditya <kumaraditya@python.org> | 2024-09-29 03:12:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-29 03:12:46 (GMT) |
commit | e0a41a5dd12cb6e9277b05abebac5c70be684dd7 (patch) | |
tree | a20512328d0092824e79714a67065ff1656a6d64 /Lib/test | |
parent | c00964ecd508ba6ae43498017d5a3873844a058a (diff) | |
download | cpython-e0a41a5dd12cb6e9277b05abebac5c70be684dd7.zip cpython-e0a41a5dd12cb6e9277b05abebac5c70be684dd7.tar.gz cpython-e0a41a5dd12cb6e9277b05abebac5c70be684dd7.tar.bz2 |
GH-124639: add back loop param to staggered_race (#124700)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_staggered.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_staggered.py b/Lib/test/test_asyncio/test_staggered.py index 21a39b3..8cd9839 100644 --- a/Lib/test/test_asyncio/test_staggered.py +++ b/Lib/test/test_asyncio/test_staggered.py @@ -121,6 +121,25 @@ class StaggeredTests(unittest.IsolatedAsyncioTestCase): self.assertIsInstance(excs[0], ValueError) self.assertIsNone(excs[1]) + def test_loop_argument(self): + loop = asyncio.new_event_loop() + async def coro(): + self.assertEqual(loop, asyncio.get_running_loop()) + return 'coro' + + async def main(): + winner, index, excs = await staggered_race( + [coro], + delay=0.1, + loop=loop + ) + + self.assertEqual(winner, 'coro') + self.assertEqual(index, 0) + + loop.run_until_complete(main()) + loop.close() + if __name__ == "__main__": unittest.main() |