1. squeaky
  2. pypy

Commits

squeaky  committed b25b440

add some extra checks for negative indices on SimpleRangeListStrategy

  • Participants
  • Parent commits 925eec5
  • Branches default

Comments (0)

Files changed (1)

File pypy/objspace/std/test/test_rangeobject.py

View file
  • Ignore whitespace
         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