diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-09-28 16:15:22 +0100 |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-09-28 16:15:22 +0100 |
commit | 28d591ceef337cc37c4b44d7958dea3f59d92018 (patch) | |
tree | 41b989c914e0a0b5e78b37dd9d19319e3284246b /Lib/unittest/mock.py | |
parent | 494502756eb7283631930c18ccaa6b137959d961 (diff) | |
download | cpython-git-28d591ceef337cc37c4b44d7958dea3f59d92018.tar.gz |
Closes issue 15323. Improve failure message of Mock.assert_called_once_with
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 95570aa3a9..324cf399b3 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -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) |