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

Method mock_add_spec

Lib/unittest/mock.py:525–531  ·  view source on GitHub ↗

Add a spec to a mock. `spec` can either be an object or a list of strings. Only attributes on the `spec` can be fetched as attributes from the mock. If `spec_set` is True then only attributes on the spec can be set.

(self, spec, spec_set=False)

Source from the content-addressed store, hash-verified

523
524
525 def mock_add_spec(self, spec, spec_set=False):
526 """Add a spec to a mock. `spec` can either be an object or a
527 list of strings. Only attributes on the `spec` can be fetched as
528 attributes from the mock.
529
530 If `spec_set` is True then only attributes on the spec can be set."""
531 self._mock_add_spec(spec, spec_set)
532
533
534 def _mock_add_spec(self, spec, spec_set, _spec_as_instance=False,

Callers

nothing calls this directly

Calls 1

_mock_add_specMethod · 0.95

Tested by

no test coverage detected