@@ -459,7 +459,8 @@ def test_cmp_err(self):
459459 seq = [CmpErr (), CmpErr (), CmpErr ()]
460460 for f in (self .module .heapify , self .module .heappop ):
461461 self .assertRaises (ZeroDivisionError , f , seq )
462- for f in (self .module .heappush , self .module .heapreplace ):
462+ for f in (self .module .heappush , self .module .heapreplace ,
463+ self .module .heappush_max , self .module .heapreplace_max ):
463464 self .assertRaises (ZeroDivisionError , f , seq , 10 )
464465 for f in (self .module .nlargest , self .module .nsmallest ):
465466 self .assertRaises (ZeroDivisionError , f , 2 , seq )
@@ -541,6 +542,17 @@ def __lt__(self, o):
541542 self .assertRaises ((IndexError , RuntimeError ), self .module .heappush , list1 , g (1 ))
542543 self .assertRaises ((IndexError , RuntimeError ), self .module .heappush , list2 , h (1 ))
543544
545+ list1 , list2 = [], []
546+
547+ self .module .heappush_max (list1 , h (0 ))
548+ self .module .heappush_max (list2 , g (0 ))
549+ self .module .heappush_max (list1 , g (1 ))
550+ self .module .heappush_max (list2 , h (1 ))
551+
552+ TestHeap .check_max_invariant (self , list1 )
553+ TestHeap .check_max_invariant (self , list2 )
554+
555+
544556class TestErrorHandlingPython (TestErrorHandling , TestCase ):
545557 module = py_heapq
546558
0 commit comments