[Python-checkins] python/dist/src/Lib/test test_b2.py,1.29.6.2,1.29.6.3

fdrake@sourceforge.net fdrake@sourceforge.net
Thu, 02 May 2002 11:13:50 -0700


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

Modified Files:
      Tag: release22-maint
	test_b2.py 
Log Message:
Add a regression test that was removed prematurely.  This tests deprecated
(but not removed!) features of the xrange object.  This test should be
maintained for all of 2.2.x to avoid regression failures.


Index: test_b2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.29.6.2
retrieving revision 1.29.6.3
diff -C2 -d -r1.29.6.2 -r1.29.6.3
*** test_b2.py	2 May 2002 16:07:59 -0000	1.29.6.2
--- test_b2.py	2 May 2002 18:13:48 -0000	1.29.6.3
***************
*** 297,300 ****
--- 297,314 ----
  if r.stop != 3: raise TestFailed, 'xrange(10, 3, -1).stop'
  if r.step != -1: raise TestFailed, 'xrange(10, 3, -1).step'
+ # regression tests for SourceForge bug #221965
+ def _range_test(r):
+     verify(r.start != r.stop, 'Test not valid for passed-in xrange object.')
+     if r.stop in r:
+         raise TestFailed, 'r.stop in ' + `r`
+     if r.stop-r.step not in r:
+         raise TestFailed, 'r.stop-r.step not in ' + `r`
+     if r.start not in r:
+         raise TestFailed, 'r.start not in ' + `r`
+     if r.stop+r.step in r:
+         raise TestFailed, 'r.stop+r.step in ' + `r`
+ _range_test(xrange(10))
+ _range_test(xrange(9, -1, -1))
+ _range_test(xrange(0, 10, 2))
  
  print 'zip'