Closes issue 15323. Improve failure message of Mock.assert_called_once_with

This commit is contained in:
Michael Foord 2012-09-28 16:15:22 +01:00
parent 494502756e
commit 28d591ceef
4 changed files with 13 additions and 4 deletions

View file

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