MCPcopy Index your code
hub / github.com/python/cpython / assert_any_call

Method assert_any_call

Lib/unittest/mock.py:1046–1059  ·  view source on GitHub ↗

assert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.

(self, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

1044
1045
1046 def assert_any_call(self, /, *args, **kwargs):
1047 """assert the mock has been called with the specified arguments.
1048
1049 The assert passes if the mock has *ever* been called, unlike
1050 `assert_called_with` and `assert_called_once_with` that only pass if
1051 the call is the most recent one."""
1052 expected = self._call_matcher(_Call((args, kwargs), two=True))
1053 cause = expected if isinstance(expected, Exception) else None
1054 actual = [self._call_matcher(c) for c in self.call_args_list]
1055 if cause or expected not in _AnyComparer(actual):
1056 expected_string = self._format_mock_call_signature(args, kwargs)
1057 raise AssertionError(
1058 '%s call not found' % expected_string
1059 ) from cause
1060
1061
1062 def _get_child_mock(self, /, **kw):

Callers 15

assert_any_callFunction · 0.80
test_cmdloopMethod · 0.80
test_newlineMethod · 0.80
test_simple_additionMethod · 0.80
test_wrapMethod · 0.80
test_resize_widerMethod · 0.80
test_resize_narrowerMethod · 0.80
test_cursor_leftMethod · 0.80
test_cursor_upMethod · 0.80
test_cursor_up_downMethod · 0.80

Calls 4

_call_matcherMethod · 0.95
_CallClass · 0.85
_AnyComparerClass · 0.85

Tested by 15

test_cmdloopMethod · 0.64
test_newlineMethod · 0.64
test_simple_additionMethod · 0.64
test_wrapMethod · 0.64
test_resize_widerMethod · 0.64
test_resize_narrowerMethod · 0.64
test_cursor_leftMethod · 0.64
test_cursor_upMethod · 0.64
test_cursor_up_downMethod · 0.64