[issue26750] Mock autospec does not work with subclasses of property()
Amaury Forgeot d'Arc
report at bugs.python.org
Wed Aug 17 18:37:19 EDT 2016
Amaury Forgeot d'Arc added the comment:
inspect.isdatadescriptor() is better indeed.
(I was initially working on an old version of mock.py which does not import inspect, and I did not want to add the dependency there).
- inspect uses hasattr(type(obj)) instead of hasatr(obj). This is better, (but does not work for 2.x old-style classes)
- my patch tested for __del__... this is completely wrong, it should have been __delete__. oops.
inspect.isdatadescriptor() does not test for __delete__. This is insaccurate, but I doubt it will ever matter. This is only possible for Python-defined descriptors, the C implementation always exposes both __set__ and __delete__ when tp_set is filled.
IOW, I'm happy with the current state.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26750>
_______________________________________
More information about the Python-bugs-list
mailing list