From: Fred Drake Date: Thu, 2 May 2002 18:13:48 +0000 (+0000) Subject: Add a regression test that was removed prematurely. This tests deprecated X-Git-Tag: v2.2.2b1~384 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3da03ca3a48212002177433eb2bdcf130c459d5c;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py index 6c14ccd47152..73d937f12451 100644 --- a/Lib/test/test_b2.py +++ b/Lib/test/test_b2.py @@ -296,6 +296,20 @@ if r.tolist() != range(10, 3, -1): if r.start != 10: raise TestFailed, 'xrange(10, 3, -1).start' 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' a = (1, 2, 3)