summaryrefslogtreecommitdiff
path: root/Lib/unittest
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2016-08-15 23:56:32 -0700
committerGregory P. Smith <greg@krypto.org>2016-08-15 23:56:32 -0700
commit680143009c121e4bf12a15500c4318ec6d6fd1b3 (patch)
treec9c83aab5bb430e893642865c6e4c97917f21516 /Lib/unittest
parent41f6404f25089034b5773757224da937284e4bc0 (diff)
parentf8fdb7d787b977741530c39b0d33f67b302c6556 (diff)
downloadcpython-680143009c121e4bf12a15500c4318ec6d6fd1b3.tar.gz
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 ed915d26bc..eaa9c3d585 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 = {}