[Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.19,1.20

Fred L. Drake python-dev@python.org
Wed, 8 Nov 2000 11:51:28 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9678/Lib/test

Modified Files:
	test_b2.py 
Log Message:

Added test cases to detect regression on SourceForge bug #121965.


Index: test_b2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** test_b2.py	2000/10/23 17:22:07	1.19
--- test_b2.py	2000/11/08 19:51:25	1.20
***************
*** 255,258 ****
--- 255,272 ----
  if tuple(xrange(0,10,2)) <> tuple(range(0,10,2)):
      raise TestFailed, 'xrange(0,10,2)'
+ # regression tests for SourceForge bug #121695
+ def _range_test(r):
+     assert 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'