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

Function _setup_func

Lib/unittest/mock.py:233–279  ·  view source on GitHub ↗
(funcopy, mock, sig)

Source from the content-addressed store, hash-verified

231
232
233def _setup_func(funcopy, mock, sig):
234 funcopy.mock = mock
235
236 def assert_called_with(*args, **kwargs):
237 return mock.assert_called_with(*args, **kwargs)
238 def assert_called(*args, **kwargs):
239 return mock.assert_called(*args, **kwargs)
240 def assert_not_called(*args, **kwargs):
241 return mock.assert_not_called(*args, **kwargs)
242 def assert_called_once(*args, **kwargs):
243 return mock.assert_called_once(*args, **kwargs)
244 def assert_called_once_with(*args, **kwargs):
245 return mock.assert_called_once_with(*args, **kwargs)
246 def assert_has_calls(*args, **kwargs):
247 return mock.assert_has_calls(*args, **kwargs)
248 def assert_any_call(*args, **kwargs):
249 return mock.assert_any_call(*args, **kwargs)
250 def reset_mock():
251 funcopy.method_calls = _CallList()
252 funcopy.mock_calls = _CallList()
253 mock.reset_mock()
254 ret = funcopy.return_value
255 if _is_instance_mock(ret) and not ret is mock:
256 ret.reset_mock()
257
258 funcopy.called = False
259 funcopy.call_count = 0
260 funcopy.call_args = None
261 funcopy.call_args_list = _CallList()
262 funcopy.method_calls = _CallList()
263 funcopy.mock_calls = _CallList()
264
265 funcopy.return_value = mock.return_value
266 funcopy.side_effect = mock.side_effect
267 funcopy._mock_children = mock._mock_children
268
269 funcopy.assert_called_with = assert_called_with
270 funcopy.assert_called_once_with = assert_called_once_with
271 funcopy.assert_has_calls = assert_has_calls
272 funcopy.assert_any_call = assert_any_call
273 funcopy.reset_mock = reset_mock
274 funcopy.assert_called = assert_called
275 funcopy.assert_not_called = assert_not_called
276 funcopy.assert_called_once = assert_called_once
277 funcopy.__signature__ = sig
278
279 mock._mock_delegate = funcopy
280
281
282def _setup_async_mock(mock):

Callers 2

_set_signatureFunction · 0.85
_set_async_signatureFunction · 0.85

Calls 1

_CallListClass · 0.85

Tested by

no test coverage detected