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

Method __init__

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

Source from the content-addressed store, hash-verified

2279 await_args_list = _delegating_property('await_args_list')
2280
2281 def __init__(self, /, *args, **kwargs):
2282 super().__init__(*args, **kwargs)
2283 # iscoroutinefunction() checks _is_coroutine property to say if an
2284 # object is a coroutine. Without this check it looks to see if it is a
2285 # function/method, which in this case it is not (since it is an
2286 # AsyncMock).
2287 # It is set through __dict__ because when spec_set is True, this
2288 # attribute is likely undefined.
2289 self.__dict__['_is_coroutine'] = asyncio.coroutines._is_coroutine
2290 self.__dict__['_mock_await_count'] = 0
2291 self.__dict__['_mock_await_args'] = None
2292 self.__dict__['_mock_await_args_list'] = _CallList()
2293 if _CODE_SIG:
2294 code_mock = NonCallableMock(spec_set=_CODE_ATTRS)
2295 code_mock.__dict__["_spec_class"] = CodeType
2296 code_mock.__dict__["_spec_signature"] = _CODE_SIG
2297 else:
2298 code_mock = NonCallableMock(spec_set=CodeType)
2299 code_mock.co_flags = (
2300 inspect.CO_COROUTINE
2301 + inspect.CO_VARARGS
2302 + inspect.CO_VARKEYWORDS
2303 )
2304 code_mock.co_argcount = 0
2305 code_mock.co_varnames = ('args', 'kwargs')
2306 code_mock.co_posonlyargcount = 0
2307 code_mock.co_kwonlyargcount = 0
2308 self.__dict__['__code__'] = code_mock
2309 self.__dict__['__name__'] = 'AsyncMock'
2310 self.__dict__['__defaults__'] = tuple()
2311 self.__dict__['__kwdefaults__'] = {}
2312 self.__dict__['__annotations__'] = None
2313
2314 async def _execute_mock_call(self, /, *args, **kwargs):
2315 # This is nearly just like super(), except for special handling

Callers

nothing calls this directly

Calls 4

superClass · 0.85
_CallListClass · 0.85
NonCallableMockClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected