[Python-checkins] python/dist/src/Lib/test test_heapq.py,1.2,1.3

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 02 Aug 2002 12:41:56 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv6386/python/Lib/test

Modified Files:
	test_heapq.py 
Log Message:
check_invariant():  Use the same child->parent "formula" used by heapq.py.


Index: test_heapq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_heapq.py	2 Aug 2002 19:16:44 -0000	1.2
--- test_heapq.py	2 Aug 2002 19:41:54 -0000	1.3
***************
*** 9,14 ****
      # Check the heap invariant.
      for pos, item in enumerate(heap):
!         parentpos = ((pos+1) >> 1) - 1
!         if parentpos >= 0:
              verify(heap[parentpos] <= item)
  
--- 9,14 ----
      # Check the heap invariant.
      for pos, item in enumerate(heap):
!         if pos: # pos 0 has no parent
!             parentpos = (pos-1) >> 1
              verify(heap[parentpos] <= item)