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

Method __init__

Lib/unittest/mock.py:1333–1368  ·  view source on GitHub ↗
(
            self, getter, attribute, new, spec, create,
            spec_set, autospec, new_callable, kwargs, *, unsafe=False
        )

Source from the content-addressed store, hash-verified

1331 _active_patches = []
1332
1333 def __init__(
1334 self, getter, attribute, new, spec, create,
1335 spec_set, autospec, new_callable, kwargs, *, unsafe=False
1336 ):
1337 if new_callable is not None:
1338 if new is not DEFAULT:
1339 raise ValueError(
1340 "Cannot use 'new' and 'new_callable' together"
1341 )
1342 if autospec is not None:
1343 raise ValueError(
1344 "Cannot use 'autospec' and 'new_callable' together"
1345 )
1346 if not unsafe:
1347 _check_spec_arg_typos(kwargs)
1348 if _is_instance_mock(spec):
1349 raise InvalidSpecError(
1350 f'Cannot spec attr {attribute!r} as the spec '
1351 f'has already been mocked out. [spec={spec!r}]')
1352 if _is_instance_mock(spec_set):
1353 raise InvalidSpecError(
1354 f'Cannot spec attr {attribute!r} as the spec_set '
1355 f'target has already been mocked out. [spec_set={spec_set!r}]')
1356
1357 self.getter = getter
1358 self.attribute = attribute
1359 self.new = new
1360 self.new_callable = new_callable
1361 self.spec = spec
1362 self.create = create
1363 self.has_local = False
1364 self.spec_set = spec_set
1365 self.autospec = autospec
1366 self.kwargs = kwargs
1367 self.additional_patchers = []
1368 self.is_started = False
1369
1370
1371 def copy(self):

Callers

nothing calls this directly

Calls 3

_check_spec_arg_typosFunction · 0.85
_is_instance_mockFunction · 0.85
InvalidSpecErrorClass · 0.85

Tested by

no test coverage detected