mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-24638: Improve the error message in asyncio.ensure_future() (#12848)
This commit is contained in:
parent
ceb842e155
commit
4737b923df
2 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue