diff options
author | Susan Su <susansu.software@gmail.com> | 2019-02-13 18:22:29 -0800 |
---|---|---|
committer | Lisa Roach <lisaroach14@gmail.com> | 2019-02-13 18:22:29 -0800 |
commit | 2bdd5858e3f89555c8de73a0f307d63536129dbd (patch) | |
tree | 244b0cf7117ac457358e249db39516814801d787 /Lib/unittest/mock.py | |
parent | 1dc5cb9cb3447211069a7788208254b1cfa8ec98 (diff) | |
download | cpython-git-2bdd5858e3f89555c8de73a0f307d63536129dbd.tar.gz |
bpo-35500: align expected and actual calls on mock.assert_called_with error message. (GH-11804)
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index ef5c55d6a1..8f46050462 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -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) |