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

Method __new__

Lib/unittest/mock.py:445–461  ·  view source on GitHub ↗
(
            cls, 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

443 _lock = RLock()
444
445 def __new__(
446 cls, spec=None, wraps=None, name=None, spec_set=None,
447 parent=None, _spec_state=None, _new_name='', _new_parent=None,
448 _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs
449 ):
450 # every instance has its own class
451 # so we can create magic methods on the
452 # class without stomping on other mocks
453 bases = (cls,)
454 if not issubclass(cls, AsyncMockMixin):
455 # Check if spec is an async object or function
456 spec_arg = spec_set or spec
457 if spec_arg is not None and _is_async_obj(spec_arg):
458 bases = (AsyncMockMixin, cls)
459 new = type(cls.__name__, bases, {'__doc__': cls.__doc__})
460 instance = _safe_super(NonCallableMock, cls).__new__(new)
461 return instance
462
463
464 def __init__(

Callers

nothing calls this directly

Calls 3

issubclassFunction · 0.85
_is_async_objFunction · 0.85
__new__Method · 0.45

Tested by

no test coverage detected