This is something I discovered and am quite please with but would to understand what is happening. The use case is I want to patch and object in a test using a decorator but I'm not really interested in the mock object.
My old way of doing it.
@patch.object(Foo, 'bar', return_value='fake value')
def test_something(self, unused_foo):
I discovered this works:
@patch.object(Foo, 'bar', Mock(return_value='fake value'))
def test_something(self):
But according to the doc there is no third argument to the patch.object decorator.
patch.object(target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
So what is going on here?