diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-05-03 15:35:26 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-05-03 15:35:25 (GMT) |
commit | 4737b923df6fbdb9e2bf3fdccea2112270556e0a (patch) | |
tree | 7e2d59f6e40479a713796953928f897463cf1c86 /Lib/test/test_asyncio | |
parent | ceb842e155f5fa0109fa88d52da3d1f5e73490ad (diff) | |
download | cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.zip cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.tar.gz cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.tar.bz2 |
bpo-24638: Improve the error message in asyncio.ensure_future() (#12848)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 1cdff52..c4f6d70 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -236,6 +236,15 @@ class BaseTaskTests: with self.assertRaises(TypeError): asyncio.ensure_future('ok') + def test_ensure_future_error_msg(self): + loop = asyncio.new_event_loop() + f = self.new_future(self.loop) + with self.assertRaisesRegex(ValueError, 'The future belongs to a ' + 'different loop than the one specified as ' + 'the loop argument'): + asyncio.ensure_future(f, loop=loop) + loop.close() + def test_get_stack(self): T = None |