summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_heapq.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
index 016fd3a..879899e 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():