summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-07 21:07:30 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-07 21:07:30 (GMT)
commit6130c0271f00e54fe754f764733668ecda617d51 (patch)
tree17a45b0e168e91690e48095e8844bf284f814aef /Lib/test/test_asyncio
parent91aa5c12ea1efe9a7bba57d0d4d31a2a182d4fcd (diff)
parent49d6b8c0c3124e94728dd44aafc33becfb14415b (diff)
downloadcpython-6130c0271f00e54fe754f764733668ecda617d51.zip
cpython-6130c0271f00e54fe754f764733668ecda617d51.tar.gz
cpython-6130c0271f00e54fe754f764733668ecda617d51.tar.bz2
Merge 3.5 (issue #28634)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_futures.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index fd4d261..c147608 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -105,6 +105,29 @@ class BaseFutureTests:
self.loop = self.new_test_loop()
self.addCleanup(self.loop.close)
+ def test_isfuture(self):
+ class MyFuture:
+ _asyncio_future_blocking = None
+
+ def __init__(self):
+ self._asyncio_future_blocking = False
+
+ self.assertFalse(asyncio.isfuture(MyFuture))
+ self.assertTrue(asyncio.isfuture(MyFuture()))
+ self.assertFalse(asyncio.isfuture(1))
+
+ # As `isinstance(Mock(), Future)` returns `False`
+ self.assertFalse(asyncio.isfuture(mock.Mock()))
+
+ f = self._new_future(loop=self.loop)
+ self.assertTrue(asyncio.isfuture(f))
+ self.assertFalse(asyncio.isfuture(type(f)))
+
+ # As `isinstance(Mock(Future), Future)` returns `True`
+ self.assertTrue(asyncio.isfuture(mock.Mock(type(f))))
+
+ f.cancel()
+
def test_initial_state(self):
f = self._new_future(loop=self.loop)
self.assertFalse(f.cancelled())