mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Closes issue 15323. Improve failure message of Mock.assert_called_once_with
This commit is contained in:
parent
494502756e
commit
28d591ceef
4 changed files with 13 additions and 4 deletions
|
@ -463,6 +463,13 @@ class MockTest(unittest.TestCase):
|
|||
mock.assert_called_with)
|
||||
|
||||
|
||||
def test_assert_called_once_with_message(self):
|
||||
mock = Mock(name='geoffrey')
|
||||
self.assertRaisesRegex(AssertionError,
|
||||
r"Expected 'geoffrey' to be called once\.",
|
||||
mock.assert_called_once_with)
|
||||
|
||||
|
||||
def test__name__(self):
|
||||
mock = Mock()
|
||||
self.assertRaises(AttributeError, lambda: mock.__name__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue