mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-111019: Align expected and actual titles in test output (GH-111020) (#111024)
gh-111019: Align expected and actual titles in test output (GH-111020)
Align expected and actual titles in output from
assert_has_calls/assert_called_with for greater readability
(cherry picked from commit 77dbd95609
)
Co-authored-by: James <morisja@gmail.com>
This commit is contained in:
parent
004618fed7
commit
577a8fb72b
2 changed files with 10 additions and 10 deletions
|
@ -827,7 +827,7 @@ class NonCallableMock(Base):
|
|||
|
||||
|
||||
def _format_mock_failure_message(self, args, kwargs, action='call'):
|
||||
message = 'expected %s not found.\nExpected: %s\nActual: %s'
|
||||
message = 'expected %s not found.\nExpected: %s\n Actual: %s'
|
||||
expected_string = self._format_mock_call_signature(args, kwargs)
|
||||
call_args = self.call_args
|
||||
actual_string = self._format_mock_call_signature(*call_args)
|
||||
|
@ -930,7 +930,7 @@ class NonCallableMock(Base):
|
|||
if self.call_args is None:
|
||||
expected = self._format_mock_call_signature(args, kwargs)
|
||||
actual = 'not called.'
|
||||
error_message = ('expected call not found.\nExpected: %s\nActual: %s'
|
||||
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
|
||||
% (expected, actual))
|
||||
raise AssertionError(error_message)
|
||||
|
||||
|
@ -981,7 +981,7 @@ class NonCallableMock(Base):
|
|||
raise AssertionError(
|
||||
f'{problem}\n'
|
||||
f'Expected: {_CallList(calls)}'
|
||||
f'{self._calls_repr(prefix="Actual").rstrip(".")}'
|
||||
f'{self._calls_repr(prefix=" Actual").rstrip(".")}'
|
||||
) from cause
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue