diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-18 08:04:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 08:04:39 (GMT) |
commit | 50d936a125b17ff31b527347c0f4c37aa85efb83 (patch) | |
tree | 8d902da6a3bc552197a0af031cd33e20e8cf46bc /Lib/unittest/mock.py | |
parent | 72131d0610baf5d486b83f79bdb63a75aa22b8f1 (diff) | |
download | cpython-50d936a125b17ff31b527347c0f4c37aa85efb83.zip cpython-50d936a125b17ff31b527347c0f4c37aa85efb83.tar.gz cpython-50d936a125b17ff31b527347c0f4c37aa85efb83.tar.bz2 |
[3.11] gh-111019: Align expected and actual titles in test output (GH-111020) (#111025)
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 77dbd956090aac66e264d9d640f6adb6b0930b87)
Co-authored-by: James <morisja@gmail.com>
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index e78eb35..3c96f1e 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -822,7 +822,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) @@ -925,7 +925,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) @@ -976,7 +976,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 |