Datasets:
File size: 406 Bytes
907001b | 1 2 3 4 5 6 7 8 9 | def patch(fn, attr_or_replacement, replacement=None):
"""pass"""
if replacement is None:
replacement = attr_or_replacement
return when2(fn, Ellipsis).thenAnswer(replacement)
else:
obj, name = (fn, attr_or_replacement)
theMock = _get_mock(obj, strict=True)
return invocation.StubbedInvocation(theMock, name, strict=False)(Ellipsis).thenAnswer(replacement) |