summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_b2.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-11-08 19:51:25 (GMT)
committerFred Drake <fdrake@acm.org>2000-11-08 19:51:25 (GMT)
commitb046b763221559c8de0c781fcbd29f54e19e600a (patch)
treed3bd6df0717946708900165839c3322e55914d99 /Lib/test/test_b2.py
parent0b796fa5c56611341f039c5ab6ed17a2b63833d2 (diff)
downloadcpython-b046b763221559c8de0c781fcbd29f54e19e600a.zip
cpython-b046b763221559c8de0c781fcbd29f54e19e600a.tar.gz
cpython-b046b763221559c8de0c781fcbd29f54e19e600a.tar.bz2
Added test cases to detect regression on SourceForge bug #121965.
Diffstat (limited to 'Lib/test/test_b2.py')
-rw-r--r--Lib/test/test_b2.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index ec6ae50..c212f2e 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -254,6 +254,20 @@ if tuple(xrange(10)) <> tuple(range(10)): raise TestFailed, 'xrange(10)'
if tuple(xrange(5,10)) <> tuple(range(5,10)): raise TestFailed, 'xrange(5,10)'
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'
a = (1, 2, 3)