Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d4583d7f
Commit
d4583d7f
authored
Aug 15, 2016
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26750: use inspect.isdatadescriptor instead of our own
_is_data_descriptor().
parent
22ba01ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
Lib/unittest/mock.py
Lib/unittest/mock.py
+1
-7
No files found.
Lib/unittest/mock.py
View file @
d4583d7f
...
...
@@ -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
.
isdata
descriptor
(
spec
):
# descriptors don't have a spec
# because we don't know what type they return
_kwargs
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment