[Python-checkins] CVS: python/dist/src/Lib/test test_structseq.py,NONE,1.1 test_descr.py,1.101,1.102 test_support.py,1.39,1.40

Tim Peters tim_one@users.sourceforge.net
Tue, 30 Oct 2001 15:20:48 -0800


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

Modified Files:
	test_descr.py test_support.py 
Added Files:
	test_structseq.py 
Log Message:
Fix bad bug in structseq slicing (NULL pointers in result).  Reported by
Jack Jansen on python-dev.
Add simple test case.
Move vereq() from test_descr to test_support (it's handy!).


--- NEW FILE: test_structseq.py ---
from test_support import vereq

import time

t = time.gmtime()
astuple = tuple(t)
vereq(len(t), len(astuple))
vereq(t, astuple)

# Check that slicing works the same way; at one point, slicing t[i:j] with
# 0 < i < j could produce NULLs in the result.
for i in range(-len(t), len(t)):
    for j in range(-len(t), len(t)):
        vereq(t[i:j], astuple[i:j])

XXX more needed

Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -d -r1.101 -r1.102
*** test_descr.py	2001/10/30 05:45:26	1.101
--- test_descr.py	2001/10/30 23:20:46	1.102
***************
*** 1,10 ****
  # Test enhancements related to descriptors and new-style classes
  
! from test_support import verify, verbose, TestFailed, TESTFN
  from copy import deepcopy
- 
- def vereq(a, b):
-     if not (a == b):
-         raise TestFailed, "%r == %r" % (a, b)
  
  def veris(a, b):
--- 1,6 ----
  # Test enhancements related to descriptors and new-style classes
  
! from test_support import verify, vereq, verbose, TestFailed, TESTFN
  from copy import deepcopy
  
  def veris(a, b):

Index: test_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** test_support.py	2001/10/04 19:46:07	1.39
--- test_support.py	2001/10/30 23:20:46	1.40
***************
*** 118,121 ****
--- 118,125 ----
          raise TestFailed(reason)
  
+ def vereq(a, b):
+     if not (a == b):
+         raise TestFailed, "%r == %r" % (a, b)
+ 
  def sortdict(dict):
      "Like repr(dict), but in sorted order."