(self)
| 2645 | |
| 2646 | |
| 2647 | def test_timer_comparison(self): |
| 2648 | def callback(*args): |
| 2649 | return args |
| 2650 | |
| 2651 | when = time.monotonic() |
| 2652 | |
| 2653 | h1 = asyncio.TimerHandle(when, callback, (), self.loop) |
| 2654 | h2 = asyncio.TimerHandle(when, callback, (), self.loop) |
| 2655 | with self.assertRaises(AssertionError): |
| 2656 | self.assertLess(h1, h2) |
| 2657 | with self.assertRaises(AssertionError): |
| 2658 | self.assertLess(h2, h1) |
| 2659 | with self.assertRaises(AssertionError): |
| 2660 | self.assertGreater(h1, h2) |
| 2661 | with self.assertRaises(AssertionError): |
| 2662 | self.assertGreater(h2, h1) |
| 2663 | with self.assertRaises(AssertionError): |
| 2664 | self.assertNotEqual(h1, h2) |
| 2665 | |
| 2666 | self.assertLessEqual(h1, h2) |
| 2667 | self.assertLessEqual(h2, h1) |
| 2668 | self.assertGreaterEqual(h1, h2) |
| 2669 | self.assertGreaterEqual(h2, h1) |
| 2670 | self.assertEqual(h1, h2) |
| 2671 | |
| 2672 | h2.cancel() |
| 2673 | with self.assertRaises(AssertionError): |
| 2674 | self.assertEqual(h1, h2) |
| 2675 | self.assertNotEqual(h1, h2) |
| 2676 | |
| 2677 | h1 = asyncio.TimerHandle(when, callback, (), self.loop) |
| 2678 | h2 = asyncio.TimerHandle(when + 10.0, callback, (), self.loop) |
| 2679 | with self.assertRaises(AssertionError): |
| 2680 | self.assertLess(h2, h1) |
| 2681 | with self.assertRaises(AssertionError): |
| 2682 | self.assertLessEqual(h2, h1) |
| 2683 | with self.assertRaises(AssertionError): |
| 2684 | self.assertGreater(h1, h2) |
| 2685 | with self.assertRaises(AssertionError): |
| 2686 | self.assertGreaterEqual(h1, h2) |
| 2687 | with self.assertRaises(AssertionError): |
| 2688 | self.assertEqual(h1, h2) |
| 2689 | |
| 2690 | self.assertLess(h1, h2) |
| 2691 | self.assertGreater(h2, h1) |
| 2692 | self.assertLessEqual(h1, h2) |
| 2693 | self.assertGreaterEqual(h2, h1) |
| 2694 | self.assertNotEqual(h1, h2) |
| 2695 | |
| 2696 | h3 = asyncio.Handle(callback, (), self.loop) |
| 2697 | self.assertIs(NotImplemented, h1.__eq__(h3)) |
| 2698 | self.assertIs(NotImplemented, h1.__ne__(h3)) |
| 2699 | |
| 2700 | with self.assertRaises(TypeError): |
| 2701 | h1 < () |
| 2702 | with self.assertRaises(TypeError): |
| 2703 | h1 > () |
| 2704 | with self.assertRaises(TypeError): |
nothing calls this directly
no test coverage detected