gh-114091: Reword error message for unawaitable types (#114090)

Reword error message for unawaitable types.
This commit is contained in:
Steele Farnsworth 2024-06-17 10:48:17 -04:00 committed by GitHub
parent a26d27e7ee
commit 2c7209a3bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 9 deletions

View file

@ -974,13 +974,13 @@ class CoroutineTest(unittest.TestCase):
async def foo():
await 1
with self.assertRaisesRegex(TypeError, "object int can.t.*await"):
with self.assertRaisesRegex(TypeError, "'int' object can.t be awaited"):
run_async(foo())
def test_await_2(self):
async def foo():
await []
with self.assertRaisesRegex(TypeError, "object list can.t.*await"):
with self.assertRaisesRegex(TypeError, "'list' object can.t be awaited"):
run_async(foo())
def test_await_3(self):
@ -1040,7 +1040,7 @@ class CoroutineTest(unittest.TestCase):
async def foo(): return await Awaitable()
with self.assertRaisesRegex(
TypeError, "object Awaitable can't be used in 'await' expression"):
TypeError, "'Awaitable' object can't be awaited"):
run_async(foo())