MCPcopy Index your code
hub / github.com/RustPython/RustPython / assert_any_call

Method assert_any_call

Lib/unittest/mock.py:1045–1058  ·  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

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

Calls 5

_call_matcherMethod · 0.95
_CallClass · 0.85
isinstanceFunction · 0.85
_AnyComparerClass · 0.85