diff options
author | Yury Selivanov <yury@magic.io> | 2017-12-23 21:29:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-23 21:29:26 (GMT) |
commit | 719ccbca69b21013a783b829de3404b5aa243827 (patch) | |
tree | 14cba4fbaeb7cd638e0e96f4ddeb1ffc39f329ac /Lib/test/test_asyncio | |
parent | a330f483e2d05f3ad1780f0542ecd8d2b0dda5df (diff) | |
download | cpython-719ccbca69b21013a783b829de3404b5aa243827.zip cpython-719ccbca69b21013a783b829de3404b5aa243827.tar.gz cpython-719ccbca69b21013a783b829de3404b5aa243827.tar.bz2 |
bpo-32415: Fix "error is already set" (#4999)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 7bb4305..4cf694f 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2302,6 +2302,32 @@ class PyTask_PyFuture_SubclassTests(BaseTaskTests, test_utils.TestCase): pass +@unittest.skipUnless(hasattr(tasks, '_CTask'), + 'requires the C _asyncio module') +class CTask_Future_Tests(test_utils.TestCase): + + def test_foobar(self): + class Fut(asyncio.Future): + @property + def get_loop(self): + raise AttributeError + + async def coro(): + await fut + return 'spam' + + self.loop = asyncio.new_event_loop() + try: + fut = Fut(loop=self.loop) + self.loop.call_later(0.1, fut.set_result(1)) + task = asyncio.Task(coro(), loop=self.loop) + res = self.loop.run_until_complete(task) + finally: + self.loop.close() + + self.assertEqual(res, 'spam') + + class BaseTaskIntrospectionTests: _register_task = None _unregister_task = None |