Closes issue 15323. Improve failure message of Mock.assert_called_once_with
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 95570aa..324cf39 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -731,8 +731,8 @@
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)