mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-35500: align expected and actual calls on mock.assert_called_with error message. (GH-11804)
This commit is contained in:
parent
1dc5cb9cb3
commit
2bdd5858e3
3 changed files with 14 additions and 9 deletions
|
@ -745,7 +745,7 @@ class NonCallableMock(Base):
|
|||
|
||||
|
||||
def _format_mock_failure_message(self, args, kwargs):
|
||||
message = 'Expected call: %s\nActual call: %s'
|
||||
message = 'expected call not found.\nExpected: %s\nActual: %s'
|
||||
expected_string = self._format_mock_call_signature(args, kwargs)
|
||||
call_args = self.call_args
|
||||
if len(call_args) == 3:
|
||||
|
@ -814,7 +814,10 @@ class NonCallableMock(Base):
|
|||
self = _mock_self
|
||||
if self.call_args is None:
|
||||
expected = self._format_mock_call_signature(args, kwargs)
|
||||
raise AssertionError('Expected call: %s\nNot called' % (expected,))
|
||||
actual = 'not called.'
|
||||
error_message = ('expected call not found.\nExpected: %s\nActual: %s'
|
||||
% (expected, actual))
|
||||
raise AssertionError(error_message)
|
||||
|
||||
def _error_message():
|
||||
msg = self._format_mock_failure_message(args, kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue