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

Function _setup_func

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…