From a4b884f9009e9797e8bb7f8c9e797b4f033dd37e Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 20 Oct 2016 15:54:20 -0400 Subject: Issue #28492: Fix how StopIteration is raised in _asyncio.Future --- Lib/test/test_asyncio/test_futures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Lib/test/test_asyncio/test_futures.py') diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index d20eb687f9..6916b513e8 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -464,6 +464,19 @@ class FutureTests(test_utils.TestCase): futures._set_result_unless_cancelled(fut, 2) self.assertTrue(fut.cancelled()) + def test_future_stop_iteration_args(self): + fut = asyncio.Future(loop=self.loop) + fut.set_result((1, 2)) + fi = fut.__iter__() + result = None + try: + fi.send(None) + except StopIteration as ex: + result = ex.args[0] + else: + self.fail('StopIteration was expected') + self.assertEqual(result, (1, 2)) + class FutureDoneCallbackTests(test_utils.TestCase): -- cgit v1.2.1