Author: Squeaky <[email protected]>
Branch: 
Changeset: r69718:b25b440c713c
Date: 2014-03-05 12:37 +0100
http://bitbucket.org/pypy/pypy/changeset/b25b440c713c/

Log:    add some extra checks for negative indices on
        SimpleRangeListStrategy

diff --git a/pypy/objspace/std/test/test_rangeobject.py 
b/pypy/objspace/std/test/test_rangeobject.py
--- a/pypy/objspace/std/test/test_rangeobject.py
+++ b/pypy/objspace/std/test/test_rangeobject.py
@@ -109,6 +109,13 @@
         assert not self.not_forced(r)
         assert r == [1, 2, 3, 4, 5, 6, 7]
 
+        r = range(4)
+        assert r[-1] == 3
+        assert r[3] == 3
+        assert r[-4] == 0
+        raises(IndexError, r.__getitem__, -5)
+        raises(IndexError, r.__getitem__, 4)
+
     def test_reduce(self):
         it = iter(range(10))
         assert it.next() == 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to