@@ -2653,33 +2653,38 @@ def callback(*args):
2653
2653
2654
2654
h1 = asyncio .TimerHandle (when , callback , (), self .loop )
2655
2655
h2 = asyncio .TimerHandle (when , callback , (), self .loop )
2656
- # TODO: Use assertLess etc.
2657
- self .assertFalse (h1 < h2 )
2658
- self .assertFalse (h2 < h1 )
2659
- self .assertTrue (h1 <= h2 )
2660
- self .assertTrue (h2 <= h1 )
2661
- self .assertFalse (h1 > h2 )
2662
- self .assertFalse (h2 > h1 )
2663
- self .assertTrue (h1 >= h2 )
2664
- self .assertTrue (h2 >= h1 )
2665
- self .assertTrue (h1 == h2 )
2666
- self .assertFalse (h1 != h2 )
2656
+ with self .assertRaises (AssertionError ):
2657
+ self .assertLess (h1 , h2 )
2658
+ self .assertLess (h2 , h1 )
2659
+ self .assertGreater (h1 , h2 )
2660
+ self .assertGreater (h2 , h1 )
2661
+ self .assertNotEqual (h1 , h2 )
2662
+
2663
+ self .assertLessEqual (h1 , h2 )
2664
+ self .assertLessEqual (h2 , h1 )
2665
+ self .assertGreaterEqual (h1 , h2 )
2666
+ self .assertGreaterEqual (h2 , h1 )
2667
+ self .assertEqual (h1 , h2 )
2667
2668
2668
2669
h2 .cancel ()
2669
- self .assertFalse (h1 == h2 )
2670
+ with self .assertRaises (AssertionError ):
2671
+ self .assertEqual (h1 , h2 )
2672
+ self .assertNotEqual (h1 , h2 )
2670
2673
2671
2674
h1 = asyncio .TimerHandle (when , callback , (), self .loop )
2672
2675
h2 = asyncio .TimerHandle (when + 10.0 , callback , (), self .loop )
2673
- self .assertTrue (h1 < h2 )
2674
- self .assertFalse (h2 < h1 )
2675
- self .assertTrue (h1 <= h2 )
2676
- self .assertFalse (h2 <= h1 )
2677
- self .assertFalse (h1 > h2 )
2678
- self .assertTrue (h2 > h1 )
2679
- self .assertFalse (h1 >= h2 )
2680
- self .assertTrue (h2 >= h1 )
2681
- self .assertFalse (h1 == h2 )
2682
- self .assertTrue (h1 != h2 )
2676
+ with self .assertRaises (AssertionError ):
2677
+ self .assertLess (h2 , h1 )
2678
+ self .assertLessEqual (h2 , h1 )
2679
+ self .assertGreater (h1 , h2 )
2680
+ self .assertGreaterEqual (h1 , h2 )
2681
+ self .assertEqual (h1 , h2 )
2682
+
2683
+ self .assertLess (h1 , h2 )
2684
+ self .assertGreater (h2 , h1 )
2685
+ self .assertLessEqual (h1 , h2 )
2686
+ self .assertGreaterEqual (h2 , h1 )
2687
+ self .assertNotEqual (h1 , h2 )
2683
2688
2684
2689
h3 = asyncio .Handle (callback , (), self .loop )
2685
2690
self .assertIs (NotImplemented , h1 .__eq__ (h3 ))
@@ -2693,19 +2698,20 @@ def callback(*args):
2693
2698
h1 <= ()
2694
2699
with self .assertRaises (TypeError ):
2695
2700
h1 >= ()
2696
- self .assertFalse (h1 == ())
2697
- self .assertTrue (h1 != ())
2698
-
2699
- self .assertTrue (h1 == ALWAYS_EQ )
2700
- self .assertFalse (h1 != ALWAYS_EQ )
2701
- self .assertTrue (h1 < LARGEST )
2702
- self .assertFalse (h1 > LARGEST )
2703
- self .assertTrue (h1 <= LARGEST )
2704
- self .assertFalse (h1 >= LARGEST )
2705
- self .assertFalse (h1 < SMALLEST )
2706
- self .assertTrue (h1 > SMALLEST )
2707
- self .assertFalse (h1 <= SMALLEST )
2708
- self .assertTrue (h1 >= SMALLEST )
2701
+ with self .assertRaises (AssertionError ):
2702
+ self .assertEqual (h1 , ())
2703
+ self .assertNotEqual (h1 , ALWAYS_EQ )
2704
+ self .assertGreater (h1 , LARGEST )
2705
+ self .assertGreaterEqual (h1 , LARGEST )
2706
+ self .assertLess (h1 , SMALLEST )
2707
+ self .assertLessEqual (h1 , SMALLEST )
2708
+
2709
+ self .assertNotEqual (h1 , ())
2710
+ self .assertEqual (h1 , ALWAYS_EQ )
2711
+ self .assertLess (h1 , LARGEST )
2712
+ self .assertLessEqual (h1 , LARGEST )
2713
+ self .assertGreaterEqual (h1 , SMALLEST )
2714
+ self .assertGreater (h1 , SMALLEST )
2709
2715
2710
2716
2711
2717
class AbstractEventLoopTests (unittest .TestCase ):
0 commit comments