This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author berdario
Recipients berdario
Date 2015-01-24.17:20:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422120039.57.0.541541438715.issue23310@psf.upfronthosting.co.za>
In-reply-to
Content
I guess this should be expected... too much magic :P

>>> from unittest.mock import MagicMock
>>> MagicMock(**{'__hash__.return_value': "FIXME"})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py", line 1772, in __init__
    _safe_super(MagicMixin, self).__init__(*args, **kw)
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py", line 881, in __init__
    _spec_state, _new_name, _new_parent, **kwargs
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py", line 410, in __init__
    self.configure_mock(**kwargs)
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py", line 560, in configure_mock
    setattr(obj, final, val)
AttributeError: 'method-wrapper' object has no attribute 'return_value'


The same happens with e.g. __str__

>>> m.configure_mock(**{'__hash__.return_value': 1})

works just fine, instead
History
Date User Action Args
2015-01-24 17:20:39berdariosetrecipients: + berdario
2015-01-24 17:20:39berdariosetmessageid: <1422120039.57.0.541541438715.issue23310@psf.upfronthosting.co.za>
2015-01-24 17:20:39berdariolinkissue23310 messages
2015-01-24 17:20:39berdariocreate