MCPcopy Index your code
hub / github.com/python-openxml/python-docx / method_mock

Function method_mock

tests/unitutil/mock.py:117–130  ·  view source on GitHub ↗

Return mock for method `method_name` on `cls`. The patch is reversed after pytest uses it.

(
    request: FixtureRequest,
    cls: type,
    method_name: str,
    autospec: bool = True,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

115
116
117def method_mock(
118 request: FixtureRequest,
119 cls: type,
120 method_name: str,
121 autospec: bool = True,
122 **kwargs: Any,
123):
124 """Return mock for method `method_name` on `cls`.
125
126 The patch is reversed after pytest uses it.
127 """
128 _patch = patch.object(cls, method_name, autospec=autospec, **kwargs)
129 request.addfinalizer(_patch.stop)
130 return _patch.start()
131
132
133def open_mock(request: FixtureRequest, module_name: str, **kwargs: Any):

Callers 15

_add_definition_Method · 0.85
_drop_definition_Method · 0.85
add_paragraph_Method · 0.85
_add_paragraph_Method · 0.85
_add_image_part_Method · 0.85
_get_by_sha1_Method · 0.85
_next_image_partname_Method · 0.85
CommentsPart_load_Method · 0.85
load_Method · 0.85
drop_rel_Method · 0.85

Calls

no outgoing calls

Tested by 15

_add_definition_Method · 0.68
_drop_definition_Method · 0.68
add_paragraph_Method · 0.68
_add_paragraph_Method · 0.68
_add_image_part_Method · 0.68
_get_by_sha1_Method · 0.68
_next_image_partname_Method · 0.68
CommentsPart_load_Method · 0.68
load_Method · 0.68
drop_rel_Method · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…