gh-130821: Add type information to error messages for invalid return type (GH-130835)

This commit is contained in:
Semyon Moroz 2025-08-14 08:04:41 +00:00 committed by GitHub
parent c9d7065188
commit 968f6e523a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 76 additions and 76 deletions

View file

@ -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)