(self)
| 711 | loop.close() |
| 712 | |
| 713 | def test_cancel(self): |
| 714 | |
| 715 | def gen(): |
| 716 | when = yield |
| 717 | self.assertAlmostEqual(10.0, when) |
| 718 | yield 0 |
| 719 | |
| 720 | loop = self.new_test_loop(gen) |
| 721 | |
| 722 | async def task(): |
| 723 | await asyncio.sleep(10.0) |
| 724 | return 12 |
| 725 | |
| 726 | t = self.new_task(loop, task()) |
| 727 | loop.call_soon(t.cancel) |
| 728 | with self.assertRaises(asyncio.CancelledError): |
| 729 | loop.run_until_complete(t) |
| 730 | self.assertTrue(t.done()) |
| 731 | self.assertTrue(t.cancelled()) |
| 732 | self.assertFalse(t.cancel()) |
| 733 | |
| 734 | def test_cancel_with_message_then_future_result(self): |
| 735 | # Test Future.result() after calling cancel() with a message. |
nothing calls this directly
no test coverage detected