0

Yes, I have seen this question and this question.

However, I am curious if I have an ambiguous object with some method, so I can't really point to the direct object.

If I can do the below, without having to specify the mock_object's module

mock_object = MagicMock()
mock_object.do_something.return_value = 5

I wonder why is something like this is requires me to patch the specific module for the object

mock_object = MagicMock()
mock_object.do_something.side_effect = [6,8]

Is not allowed? Is there a way to do this without specifying the specific object that the mock_object is tied to??

Bao Thai
  • 474
  • 1
  • 5
  • 22

0 Answers0