(self)
| 390 | coro.close(); gen_coro.close(); # silence warnings |
| 391 | |
| 392 | def test_isawaitable(self): |
| 393 | def gen(): yield |
| 394 | self.assertFalse(inspect.isawaitable(gen())) |
| 395 | |
| 396 | coro = coroutine_function_example(1) |
| 397 | gen_coro = gen_coroutine_function_example(1) |
| 398 | |
| 399 | self.assertTrue(inspect.isawaitable(coro)) |
| 400 | self.assertTrue(inspect.isawaitable(gen_coro)) |
| 401 | |
| 402 | class Future: |
| 403 | def __await__(): |
| 404 | pass |
| 405 | self.assertTrue(inspect.isawaitable(Future())) |
| 406 | self.assertFalse(inspect.isawaitable(Future)) |
| 407 | |
| 408 | class NotFuture: pass |
| 409 | not_fut = NotFuture() |
| 410 | not_fut.__await__ = lambda: None |
| 411 | self.assertFalse(inspect.isawaitable(not_fut)) |
| 412 | |
| 413 | coro.close(); gen_coro.close() # silence warnings |
| 414 | |
| 415 | def test_isroutine(self): |
| 416 | # method |
nothing calls this directly
no test coverage detected