diff options
author | Gregory P. Smith <greg@krypto.org> | 2016-08-16 06:23:40 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2016-08-16 06:23:40 (GMT) |
commit | d4583d7fea9e3fbbc0a8f5333003938e358b5a58 (patch) | |
tree | cbd75790339f0cef3134855b951cf5ee70786cfc /Lib/unittest | |
parent | 22ba01ea550a0a6a0bb1e2a6f2758acd46797d2b (diff) | |
download | cpython-d4583d7fea9e3fbbc0a8f5333003938e358b5a58.zip cpython-d4583d7fea9e3fbbc0a8f5333003938e358b5a58.tar.gz cpython-d4583d7fea9e3fbbc0a8f5333003938e358b5a58.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.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 83e9c46..669890a 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -72,12 +72,6 @@ DescriptorTypes = ( ) -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 @@ -2138,7 +2132,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 = {} |