def test__Heap_insert(xs): xs = list(xs) heap = Heap() for x in xs: heap.insert(x) assert x in heap.to_list('inorder') assert heap.is_heap_satisfied()
def test__Heap_remove_and_insert2(xs, ys): ''' This test performs a mixture of both insertions and removals. This ensures that there are no weird interactions between inserting and removing. ''' xs = list(xs) heap = Heap(xs) for y in ys: heap.insert(y) heap.remove_min() assert heap.is_heap_satisfied()