[issue33236] MagicMock().__iter__.return_value is different from MagicMock().__iter__()

Robert report at bugs.python.org
Thu Sep 20 16:31:02 EDT 2018


Robert <lma at posteo.de> added the comment:

According to this chapter ( https://docs.python.org/3/library/unittest.mock.html#unittest.mock.MagicMock ) the specialmethods in MagicMock are different:

.return_value is preinitialized with defaultvalues, which depends on the operator. In the case of .__iter__ this is "iter([])".
This is the case when running __iter__(), but not when running __iter__.result_value

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33236>
_______________________________________


More information about the Python-bugs-list mailing list