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:
Xtreak 2019-05-29 12:32:26 +05:30 committed by Miss Islington (bot)
parent 744c08a9c7
commit 0ae022c6a4
3 changed files with 11 additions and 8 deletions

View file

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