Mario Corchero <marioc...@gmail.com> added the comment:
iter is initialized by using side_effects, not return_value. The statement "According to the documentation .return_value should be identical to the object returned when calling the mock" works only when it return_value has been used to define the behaviour of the mock. Example: ``` >>> m = MagicMock(side_effect=lambda: 1) >>> m() 1 >>> m.return_value <MagicMock name='mock()' id='140107830678472'> >>> m() is m.return_value False ``` ---------- nosy: +mariocj89 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33236> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com