mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #24400: Remove inspect.isawaitable().
isawaitable() was added before collections.abc.Awaitable; now, with Awaitable, it is no longer needed (we don't have ishashable() or isiterable() methods in the inspect module either).
This commit is contained in:
parent
86cd7d6b75
commit
a74b5e59af
4 changed files with 2 additions and 42 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue