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

Method _execute_mock_call

Lib/unittest/mock.py:1227–1254  ·  view source on GitHub ↗
(self, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

1225 _new_parent = _new_parent._mock_new_parent
1226
1227 def _execute_mock_call(self, /, *args, **kwargs):
1228 # separate from _increment_mock_call so that awaited functions are
1229 # executed separately from their call, also AsyncMock overrides this method
1230
1231 effect = self.side_effect
1232 if effect is not None:
1233 if _is_exception(effect):
1234 raise effect
1235 elif not _callable(effect):
1236 result = next(effect)
1237 if _is_exception(result):
1238 raise result
1239 else:
1240 result = effect(*args, **kwargs)
1241
1242 if result is not DEFAULT:
1243 return result
1244
1245 if self._mock_return_value is not DEFAULT:
1246 return self.return_value
1247
1248 if self._mock_delegate and self._mock_delegate.return_value is not DEFAULT:
1249 return self.return_value
1250
1251 if self._mock_wraps is not None:
1252 return self._mock_wraps(*args, **kwargs)
1253
1254 return self.return_value
1255
1256
1257

Callers 1

_mock_callMethod · 0.95

Calls 3

_is_exceptionFunction · 0.85
_callableFunction · 0.85
nextFunction · 0.85

Tested by

no test coverage detected