MCPcopy
hub / github.com/python-openxml/python-docx / class_mock

Function class_mock

tests/unitutil/mock.py:35–46  ·  view source on GitHub ↗

Return mock patching 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

33
34
35def class_mock(
36 request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any
37) -> Mock:
38 """Return mock patching class with qualified name `q_class_name`.
39
40 The mock is autospec'ed based on the patched class unless the optional
41 argument `autospec` is set to False. Any other keyword arguments are
42 passed through to Mock(). Patch is reversed after calling test returns.
43 """
44 _patch = patch(q_class_name, autospec=autospec, **kwargs)
45 request.addfinalizer(_patch.stop)
46 return _patch.start()
47
48
49def cls_attr_mock(

Callers 15

Section_Method · 0.85
_Footer_Method · 0.85
_Header_Method · 0.85
_Body_Method · 0.85
Section_Method · 0.85
Sections_Method · 0.85
Package_Method · 0.85
Image_Method · 0.85
ImagePart_Method · 0.85
Comments_Method · 0.85

Calls

no outgoing calls

Tested by 15

Section_Method · 0.68
_Footer_Method · 0.68
_Header_Method · 0.68
_Body_Method · 0.68
Section_Method · 0.68
Sections_Method · 0.68
Package_Method · 0.68
Image_Method · 0.68
ImagePart_Method · 0.68
Comments_Method · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…