We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d80510 commit a410938Copy full SHA for a410938
1 file changed
Lib/test/test_asyncio/test_futures.py
@@ -756,18 +756,13 @@ def test_future_disallow_multiple_initialization(self):
756
f.__init__(loop=self.loop)
757
758
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())
+ fut = self._new_future()
+ it = fut.__await__()
+ next(it)
+ with self.assertRaises(RuntimeError):
+ it.throw(RuntimeError)
+ with self.assertRaises(StopIteration):
+ it.send(None)
771
772
773
@unittest.skipUnless(hasattr(futures, '_CFuture'),
0 commit comments