Sometimes when you mock in a unit test, you just do it because you want to verify something was called but you don’t want the object itself to be replaced in any way. This can be done by adding the wraps option on the python mocker.

with patch.object(mocked_function, 'func', wraps=mocked_function.func) as func_mock: