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