diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-08-02 19:41:54 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-08-02 19:41:54 +0000 |
commit | a25920e3549933e4c6c158cc9490f3eaa883ec66 (patch) | |
tree | e425f726f6c1d77c31959d24ac38495751bd6671 /Lib/test/test_heapq.py | |
parent | 7a4a52d5b4ae868f02aac8a5ca6ad27564276e45 (diff) | |
download | cpython-a25920e3549933e4c6c158cc9490f3eaa883ec66.tar.gz |
check_invariant(): Use the same child->parent "formula" used by heapq.py.
Diffstat (limited to 'Lib/test/test_heapq.py')
-rw-r--r-- | Lib/test/test_heapq.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py index 016fd3af41..879899e35c 100644 --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -8,8 +8,8 @@ import random def check_invariant(heap): # Check the heap invariant. for pos, item in enumerate(heap): - parentpos = ((pos+1) >> 1) - 1 - if parentpos >= 0: + if pos: # pos 0 has no parent + parentpos = (pos-1) >> 1 verify(heap[parentpos] <= item) def test_main(): |