mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-37075: Fix string concatenation in assert_has_awaits error message (GH-13616)
* Fix the implicit string concatenation in `assert_has_awaits` error message. * Use "await" instead of "call" in `assert_awaited_with` error message. https://bugs.python.org/issue37075
This commit is contained in:
parent
744c08a9c7
commit
0ae022c6a4
3 changed files with 11 additions and 8 deletions
|
@ -542,7 +542,8 @@ class AsyncMockAssert(unittest.TestCase):
|
|||
|
||||
def test_assert_awaited_with(self):
|
||||
asyncio.run(self._runnable_test())
|
||||
with self.assertRaises(AssertionError):
|
||||
msg = 'expected await not found'
|
||||
with self.assertRaisesRegex(AssertionError, msg):
|
||||
self.mock.assert_awaited_with('foo')
|
||||
|
||||
asyncio.run(self._runnable_test('foo'))
|
||||
|
@ -580,8 +581,9 @@ class AsyncMockAssert(unittest.TestCase):
|
|||
def test_assert_has_awaits_no_order(self):
|
||||
calls = [call('NormalFoo'), call('baz')]
|
||||
|
||||
with self.assertRaises(AssertionError):
|
||||
with self.assertRaises(AssertionError) as cm:
|
||||
self.mock.assert_has_awaits(calls)
|
||||
self.assertEqual(len(cm.exception.args), 1)
|
||||
|
||||
asyncio.run(self._runnable_test('foo'))
|
||||
with self.assertRaises(AssertionError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue