Skip to content

Commit 690746c

Browse files
add test
1 parent 0027565 commit 690746c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Lib/test/test_asyncio/test_staggered.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,25 @@ async def coro(index):
121121
self.assertIsInstance(excs[0], ValueError)
122122
self.assertIsNone(excs[1])
123123

124+
def test_loop_argument(self):
125+
loop = asyncio.new_event_loop()
126+
async def coro():
127+
self.assertEqual(loop, asyncio.get_running_loop())
128+
return 'coro'
129+
130+
async def main():
131+
winner, index, excs = await staggered_race(
132+
[coro],
133+
delay=0.1,
134+
loop=loop
135+
)
136+
137+
self.assertEqual(winner, 'coro')
138+
self.assertEqual(index, 0)
139+
140+
loop.run_until_complete(main())
141+
loop.close()
142+
124143

125144
if __name__ == "__main__":
126145
unittest.main()

0 commit comments

Comments
 (0)