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

Method assert_called_with

Lib/unittest/mock.py:966–985  ·  view source on GitHub ↗

assert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.

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

Source from the content-addressed store, hash-verified

964 raise AssertionError(msg)
965
966 def assert_called_with(self, /, *args, **kwargs):
967 """assert that the last call was made with the specified arguments.
968
969 Raises an AssertionError if the args and keyword args passed in are
970 different to the last call to the mock."""
971 if self.call_args is None:
972 expected = self._format_mock_call_signature(args, kwargs)
973 actual = 'not called.'
974 error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
975 % (expected, actual))
976 raise AssertionError(error_message)
977
978 def _error_message():
979 msg = self._format_mock_failure_message(args, kwargs)
980 return msg
981 expected = self._call_matcher(_Call((args, kwargs), two=True))
982 actual = self._call_matcher(self.call_args)
983 if actual != expected:
984 cause = expected if isinstance(expected, Exception) else None
985 raise AssertionError(_error_message()) from cause
986
987
988 def assert_called_once_with(self, /, *args, **kwargs):

Callers 15

assert_called_withFunction · 0.80
test_unregisterMethod · 0.80
test_open_argsMethod · 0.80
test_read_mime_typesMethod · 0.80
_testMethod · 0.80
test_resets_termiosMethod · 0.80
test_dump_urMethod · 0.80

Calls 4

_call_matcherMethod · 0.95
_CallClass · 0.85
isinstanceFunction · 0.85

Tested by 15

test_unregisterMethod · 0.64
test_open_argsMethod · 0.64
test_read_mime_typesMethod · 0.64
_testMethod · 0.64
test_resets_termiosMethod · 0.64
test_dump_urMethod · 0.64
test_find_with_cMethod · 0.64
test_sysexcepthookMethod · 0.64