Open GoogleCodeExporter opened 9 years ago
mock.assert_has_calls checks against the mock_calls list of a mock - which
*explicitly* includes calls to child mocks. The documentation could probably be
clearer on this issue. If you don't want to track calls to __eq__ you could use
Mock instead of MagicMock.
You could also set any_order=True in the call to assert_has_calls(...). This
ignores the extra calls. Or you could use ANY as a placeholder for the errant
calls.
Original comment by fuzzyman
on 27 Jul 2012 at 11:18
@fuzzyman Thank you for the clarification. I was about to ask to close this
issue. I saw in the unit tests for mock that this was a design decision.
Although, I'm not entirely sure I agree with that design choice, I do see it's
applicability and appreciate the workarounds. However, it isn't clear in the
documentation that this is the behavior of assert_has_calls.
Original comment by somnium...@gmail.com
on 27 Jul 2012 at 11:25
If you *want* to check calls to child mocks then it's a very useful design
choice. If you don't it isn't I guess...
I'm going to change this issue to a doc clarification task.
Original comment by fuzzyman
on 27 Jul 2012 at 11:27
Original issue reported on code.google.com by
somnium...@gmail.com
on 27 Jul 2012 at 10:22