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

Method __init__

Lib/unittest/mock.py:465–507  ·  view source on GitHub ↗
(
            self, spec=None, wraps=None, name=None, spec_set=None,
            parent=None, _spec_state=None, _new_name='', _new_parent=None,
            _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs
        )

Source from the content-addressed store, hash-verified

463
464
465 def __init__(
466 self, spec=None, wraps=None, name=None, spec_set=None,
467 parent=None, _spec_state=None, _new_name='', _new_parent=None,
468 _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs
469 ):
470 if _new_parent is None:
471 _new_parent = parent
472
473 __dict__ = self.__dict__
474 __dict__['_mock_parent'] = parent
475 __dict__['_mock_name'] = name
476 __dict__['_mock_new_name'] = _new_name
477 __dict__['_mock_new_parent'] = _new_parent
478 __dict__['_mock_sealed'] = False
479
480 if spec_set is not None:
481 spec = spec_set
482 spec_set = True
483 if _eat_self is None:
484 _eat_self = parent is not None
485
486 self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)
487
488 __dict__['_mock_children'] = {}
489 __dict__['_mock_wraps'] = wraps
490 __dict__['_mock_delegate'] = None
491
492 __dict__['_mock_called'] = False
493 __dict__['_mock_call_args'] = None
494 __dict__['_mock_call_count'] = 0
495 __dict__['_mock_call_args_list'] = _CallList()
496 __dict__['_mock_mock_calls'] = _CallList()
497
498 __dict__['method_calls'] = _CallList()
499 __dict__['_mock_unsafe'] = unsafe
500
501 if kwargs:
502 self.configure_mock(**kwargs)
503
504 _safe_super(NonCallableMock, self).__init__(
505 spec, wraps, name, spec_set, parent,
506 _spec_state
507 )
508
509
510 def attach_mock(self, mock, attribute):

Callers

nothing calls this directly

Calls 4

_mock_add_specMethod · 0.95
configure_mockMethod · 0.95
_CallListClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected