Author xtreak
Recipients michael.foord, mrh1997, xtreak
Date 2018-09-20.12:37:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537447041.5.0.956365154283.issue33236@psf.upfronthosting.co.za>
In-reply-to
Content
Can you please link to the relevant documentation that is misleading? As I can see from the source code return value is a Mock object [1] which I believe the docs state as below : 

https://docs.python.org/3/library/unittest.mock.html#calling

> Mock objects are callable. The call will return the value set as the return_value attribute. The default return value is a new Mock object; it is created the first time the return value is accessed (either explicitly or by calling the Mock) - but it is stored and the same one returned each time.

from unittest.mock import MagicMock
x = MagicMock()

print(x.__iter__())
print(x.__iter__.return_value)
print(x.return_value)


➜  cpython git:(master) ./python.exe bpo33236.py
<list_iterator object at 0x10d0797f0>
<MagicMock name='mock.__iter__()' id='4513568752'>
<MagicMock name='mock()' id='4513642816'>


[1] : https://github.com/python/cpython/blob/b10a64d117de6121ea3e79c467c4107f8f399f3d/Lib/unittest/mock.py#L463


Thanks
History
Date User Action Args
2018-09-20 12:37:21xtreaksetrecipients: + xtreak, michael.foord, mrh1997
2018-09-20 12:37:21xtreaksetmessageid: <1537447041.5.0.956365154283.issue33236@psf.upfronthosting.co.za>
2018-09-20 12:37:21xtreaklinkissue33236 messages
2018-09-20 12:37:21xtreakcreate