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

@ -731,8 +731,8 @@ class NonCallableMock(Base):
arguments."""
self = _mock_self
if not self.call_count == 1:
msg = ("Expected to be called once. Called %s times." %
self.call_count)
msg = ("Expected '%s' to be called once. Called %s times." %
(self._mock_name or 'mock', self.call_count))
raise AssertionError(msg)
return self.assert_called_with(*args, **kwargs)