diff options
author | davidair <davidair@users.noreply.github.com> | 2018-08-17 15:09:58 -0400 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2018-08-17 12:09:58 -0700 |
commit | 2b32da2fea1f077bb07a175f97ad8241e5605169 (patch) | |
tree | fe64646c6d5ed966536ecb846ac59c8e865ebd15 /Lib/unittest/mock.py | |
parent | a2510732da4c75789cc1750a034bdc9d9fdffb5b (diff) | |
download | cpython-git-2b32da2fea1f077bb07a175f97ad8241e5605169.tar.gz |
Improve error message when mock.assert_has_calls fails (GH-8205)
This makes the assertion error message more useful, aiding debugging.
Thanks @davidair!
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 19dabddc7d..db1e642c00 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -862,7 +862,9 @@ class NonCallableMock(Base): not_found.append(kall) if not_found: raise AssertionError( - '%r not all found in call list' % (tuple(not_found),) + '%r does not contain all of %r in its call list, ' + 'found %r instead' % (self._mock_name or 'mock', + tuple(not_found), all_calls) ) from cause |