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

Method decoration_helper

Lib/unittest/mock.py:1414–1425  ·  view source on GitHub ↗
(self, patched, args, keywargs)

Source from the content-addressed store, hash-verified

1412
1413 @contextlib.contextmanager
1414 def decoration_helper(self, patched, args, keywargs):
1415 extra_args = []
1416 with contextlib.ExitStack() as exit_stack:
1417 for patching in patched.patchings:
1418 arg = exit_stack.enter_context(patching)
1419 if patching.attribute_name is not None:
1420 keywargs.update(arg)
1421 elif patching.new is DEFAULT:
1422 extra_args.append(arg)
1423
1424 args += tuple(extra_args)
1425 yield (args, keywargs)
1426
1427
1428 def decorate_callable(self, func):

Callers 1

patchedMethod · 0.95

Calls 3

enter_contextMethod · 0.80
updateMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected