mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
gh-130821: Add type information to error messages for invalid return type (GH-130835)
This commit is contained in:
parent
c9d7065188
commit
968f6e523a
14 changed files with 76 additions and 76 deletions
|
|
@ -1008,7 +1008,7 @@ async def foo():
|
|||
return (await Awaitable())
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, "__await__.*returned non-iterator of type"):
|
||||
TypeError, "__await__.*must return an iterator, not"):
|
||||
|
||||
run_async(foo())
|
||||
|
||||
|
|
@ -1106,7 +1106,7 @@ async def foo():
|
|||
return await Awaitable()
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, r"__await__\(\) returned a coroutine"):
|
||||
TypeError, r"__await__\(\) must return an iterator, not coroutine"):
|
||||
run_async(foo())
|
||||
|
||||
c.close()
|
||||
|
|
@ -1120,7 +1120,7 @@ async def foo():
|
|||
return await Awaitable()
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, "__await__.*returned non-iterator of type"):
|
||||
TypeError, "__await__.*must return an iterator, not"):
|
||||
|
||||
run_async(foo())
|
||||
|
||||
|
|
@ -2490,7 +2490,7 @@ async def foo():
|
|||
return (await future)
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, "__await__.*returned non-iterator of type 'int'"):
|
||||
TypeError, "__await__.*must return an iterator, not int"):
|
||||
self.assertEqual(foo().send(None), 1)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue