summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/inspect.py4
-rw-r--r--Lib/test/test_inspect.py25
2 files changed, 0 insertions, 29 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 6285a6c..f48769e 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -186,10 +186,6 @@ def iscoroutinefunction(object):
return bool((isfunction(object) or ismethod(object)) and
object.__code__.co_flags & CO_COROUTINE)
-def isawaitable(object):
- """Return true if the object can be used in "await" expression."""
- return isinstance(object, collections.abc.Awaitable)
-
def isgenerator(object):
"""Return true if the object is a generator.
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 39fa484..ebd106c 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -159,31 +159,6 @@ class TestPredicates(IsTestBase):
coro.close(); gen_coro.close() # silence warnings
- def test_isawaitable(self):
- def gen(): yield
- self.assertFalse(inspect.isawaitable(gen()))
-
- coro = coroutine_function_example(1)
- gen_coro = gen_coroutine_function_example(1)
-
- self.assertTrue(
- inspect.isawaitable(coro))
- self.assertTrue(
- inspect.isawaitable(gen_coro))
-
- class Future:
- def __await__():
- pass
- self.assertTrue(inspect.isawaitable(Future()))
- self.assertFalse(inspect.isawaitable(Future))
-
- class NotFuture: pass
- not_fut = NotFuture()
- not_fut.__await__ = lambda: None
- self.assertFalse(inspect.isawaitable(not_fut))
-
- coro.close(); gen_coro.close() # silence warnings
-
def test_isroutine(self):
self.assertTrue(inspect.isroutine(mod.spam))
self.assertTrue(inspect.isroutine([].count))