MCPcopy Create free account
hub / github.com/scanny/python-pptx / class_mock

Function class_mock

tests/unitutil/mock.py:23–34  ·  view source on GitHub ↗

Return a mock patching the class with qualified name *q_class_name*. The mock is autospec'ed based on the patched class unless the optional argument *autospec* is set to False. Any other keyword arguments are passed through to Mock(). Patch is reversed after calling test returns.

(
    request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any
)

Source from the content-addressed store, hash-verified

21
22
23def class_mock(
24 request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any
25) -> Mock:
26 """Return a mock patching the class with qualified name *q_class_name*.
27
28 The mock is autospec'ed based on the patched class unless the optional argument
29 *autospec* is set to False. Any other keyword arguments are passed through to
30 Mock(). Patch is reversed after calling test returns.
31 """
32 _patch = patch(q_class_name, autospec=autospec, **kwargs)
33 request.addfinalizer(_patch.stop)
34 return _patch.start()
35
36
37def cls_attr_mock(

Callers 15

_Cell_Method · 0.85
TcRange_Method · 0.85
_Cell_Method · 0.85
_CellCollection_Method · 0.85
SlideMasters_Method · 0.85
Slides_Method · 0.85
_Background_Method · 0.85
MasterPlaceholders_Method · 0.85
MasterShapes_Method · 0.85

Calls

no outgoing calls

Tested by 15

_Cell_Method · 0.68
TcRange_Method · 0.68
_Cell_Method · 0.68
_CellCollection_Method · 0.68
SlideMasters_Method · 0.68
Slides_Method · 0.68
_Background_Method · 0.68
MasterPlaceholders_Method · 0.68
MasterShapes_Method · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…