I have the following function with image a python object from a module and having the method shape.
def foo(image):
print image.shape
I want to mock the object image and it's return value
image = Mock()
image.shape.return_value = (0,0)
foo(image)
>>> <Mock name='mock.shape' id='4416382544'>
Calling foo(image), image.shape will return . How can I make it return (0,0)? (I need to get the value to test some condition like if image.shape = (0,0). I'm struggling to have it work.
Thanks for your help
printisn'treturn.image.shape = (0, 0)whereimageis theMockinstance.