File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ def isfuture(obj):
117
117
itself as duck-type compatible by setting _asyncio_future_blocking.
118
118
See comment in Future for more details.
119
119
"""
120
- return (hasattr (type ( obj ) , '_asyncio_future_blocking' ) and
120
+ return (hasattr (obj . __class__ , '_asyncio_future_blocking' ) and
121
121
obj ._asyncio_future_blocking is not None )
122
122
123
123
Original file line number Diff line number Diff line change @@ -113,8 +113,13 @@ def __init__(self):
113
113
114
114
self .assertFalse (asyncio .isfuture (1 ))
115
115
self .assertFalse (asyncio .isfuture (asyncio .Future ))
116
+
117
+ # As `isinstance(Mock(), Future)` returns `False`
116
118
self .assertFalse (asyncio .isfuture (mock .Mock ()))
117
119
120
+ # As `isinstance(Mock(Future), Future)` returns `True`
121
+ self .assertTrue (asyncio .isfuture (mock .Mock (asyncio .Future )))
122
+
118
123
f = asyncio .Future (loop = self .loop )
119
124
self .assertTrue (asyncio .isfuture (f ))
120
125
f .cancel ()
You can’t perform that action at this time.
0 commit comments