Skip to content

Commit a410938

Browse files
Update Test
1 parent 8d80510 commit a410938

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Lib/test/test_asyncio/test_futures.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -756,18 +756,13 @@ def test_future_disallow_multiple_initialization(self):
756756
f.__init__(loop=self.loop)
757757

758758
def test_futureiter_send_after_throw_no_crash(self):
759-
async def run_test():
760-
loop = asyncio.get_event_loop()
761-
fut = loop.create_future()
762-
it = fut.__await__()
763-
it.__next__()
764-
try:
765-
it.throw(RuntimeError)
766-
except RuntimeError:
767-
pass
768-
with self.assertRaises(StopIteration):
769-
it.send(None)
770-
asyncio.run(run_test())
759+
fut = self._new_future()
760+
it = fut.__await__()
761+
next(it)
762+
with self.assertRaises(RuntimeError):
763+
it.throw(RuntimeError)
764+
with self.assertRaises(StopIteration):
765+
it.send(None)
771766

772767

773768
@unittest.skipUnless(hasattr(futures, '_CFuture'),

0 commit comments

Comments
 (0)