summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2016-08-16 06:56:32 (GMT)
committerGregory P. Smith <greg@krypto.org>2016-08-16 06:56:32 (GMT)
commitc35a32fe850c3fc1edf32569b7aee8468209a23f (patch)
tree28c65abbf3b79ec3c4d19742ae63d86f96b14353 /Lib/unittest
parentf050a33ce28df597ce0be5f80f1fc6b2c2e3e52a (diff)
parentd4583d7fea9e3fbbc0a8f5333003938e358b5a58 (diff)
downloadcpython-c35a32fe850c3fc1edf32569b7aee8468209a23f.zip
cpython-c35a32fe850c3fc1edf32569b7aee8468209a23f.tar.gz
cpython-c35a32fe850c3fc1edf32569b7aee8468209a23f.tar.bz2
Issue #26750: use inspect.isdatadescriptor instead of our own
_is_data_descriptor().
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/mock.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index ed915d2..eaa9c3d 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -60,12 +60,6 @@ def _is_exception(obj):
)
-def _is_data_descriptor(obj):
- # Data descriptors are Properties, slots, getsets and C data members.
- return ((hasattr(obj, '__set__') or hasattr(obj, '__del__')) and
- hasattr(obj, '__get__'))
-
-
def _get_signature_object(func, as_instance, eat_self):
"""
Given an arbitrary, possibly callable object, try to create a suitable
@@ -2149,7 +2143,7 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
_kwargs.update(kwargs)
Klass = MagicMock
- if _is_data_descriptor(spec):
+ if inspect.isdatadescriptor(spec):
# descriptors don't have a spec
# because we don't know what type they return
_kwargs = {}