MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/unittest/mock.py:1280–1314  ·  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

1278 _active_patches = []
1279
1280 def __init__(
1281 self, getter, attribute, new, spec, create,
1282 spec_set, autospec, new_callable, kwargs, *, unsafe=False
1283 ):
1284 if new_callable is not None:
1285 if new is not DEFAULT:
1286 raise ValueError(
1287 "Cannot use 'new' and 'new_callable' together"
1288 )
1289 if autospec is not None:
1290 raise ValueError(
1291 "Cannot use 'autospec' and 'new_callable' together"
1292 )
1293 if not unsafe:
1294 _check_spec_arg_typos(kwargs)
1295 if _is_instance_mock(spec):
1296 raise InvalidSpecError(
1297 f'Cannot spec attr {attribute!r} as the spec '
1298 f'has already been mocked out. [spec={spec!r}]')
1299 if _is_instance_mock(spec_set):
1300 raise InvalidSpecError(
1301 f'Cannot spec attr {attribute!r} as the spec_set '
1302 f'target has already been mocked out. [spec_set={spec_set!r}]')
1303
1304 self.getter = getter
1305 self.attribute = attribute
1306 self.new = new
1307 self.new_callable = new_callable
1308 self.spec = spec
1309 self.create = create
1310 self.has_local = False
1311 self.spec_set = spec_set
1312 self.autospec = autospec
1313 self.kwargs = kwargs
1314 self.additional_patchers = []
1315
1316
1317 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