mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
gh-114091: Reword error message for unawaitable types (#114090)
Reword error message for unawaitable types.
This commit is contained in:
parent
a26d27e7ee
commit
2c7209a3bd
5 changed files with 10 additions and 9 deletions
|
@ -39,7 +39,7 @@ class LockTests(unittest.IsolatedAsyncioTestCase):
|
|||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
"object Lock can't be used in 'await' expression"
|
||||
"'Lock' object can't be awaited"
|
||||
):
|
||||
await lock
|
||||
|
||||
|
@ -77,7 +77,7 @@ class LockTests(unittest.IsolatedAsyncioTestCase):
|
|||
self.assertFalse(lock.locked())
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
r"object \w+ can't be used in 'await' expression"
|
||||
r"'\w+' object can't be awaited"
|
||||
):
|
||||
with await lock:
|
||||
pass
|
||||
|
@ -941,7 +941,7 @@ class SemaphoreTests(unittest.IsolatedAsyncioTestCase):
|
|||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
"object Semaphore can't be used in 'await' expression",
|
||||
"'Semaphore' object can't be awaited",
|
||||
):
|
||||
await sem
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ class BarrierTests(unittest.IsolatedAsyncioTestCase):
|
|||
self.assertIn("filling", repr(barrier))
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
"object Barrier can't be used in 'await' expression",
|
||||
"'Barrier' object can't be awaited",
|
||||
):
|
||||
await barrier
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue