2👍
✅
From your function here, stream
seems to be a class.
Since you create an instance of that class and then you call the open
method on that instance, you need to do mock_stream.return_value.open.return_value = False
in the test function.
Source:stackexchange.com