Commit 8baa7461 authored by Tim Peters's avatar Tim Peters

testItemsNegativeIndex (3 instances): repaired off-by-one glitch in loop...

testItemsNegativeIndex (3 instances):  repaired off-by-one glitch in loop (range(i, j, k) is always exclusive of j).
parent a23c8981
...@@ -212,7 +212,7 @@ class MappingBase(Base): ...@@ -212,7 +212,7 @@ class MappingBase(Base):
self.t[i] = i self.t[i] = i
L.sort() L.sort()
vals = self.t.values() vals = self.t.values()
for i in range(-1, -4, -1): for i in range(-1, -5, -1):
self.assertEqual(vals[i], L[i]) self.assertEqual(vals[i], L[i])
self.assertRaises(IndexError, lambda: vals[-5]) self.assertRaises(IndexError, lambda: vals[-5])
...@@ -241,7 +241,7 @@ class MappingBase(Base): ...@@ -241,7 +241,7 @@ class MappingBase(Base):
self.t[i] = i self.t[i] = i
L.sort() L.sort()
keys = self.t.keys() keys = self.t.keys()
for i in range(-1, -4, -1): for i in range(-1, -5, -1):
self.assertEqual(keys[i], L[i]) self.assertEqual(keys[i], L[i])
self.assertRaises(IndexError, lambda: keys[-5]) self.assertRaises(IndexError, lambda: keys[-5])
...@@ -273,7 +273,7 @@ class MappingBase(Base): ...@@ -273,7 +273,7 @@ class MappingBase(Base):
self.t[i] = i self.t[i] = i
L.sort() L.sort()
items = self.t.items() items = self.t.items()
for i in range(-1, -4, -1): for i in range(-1, -5, -1):
self.assertEqual(items[i], (L[i], L[i])) self.assertEqual(items[i], (L[i], L[i]))
self.assertRaises(IndexError, lambda: items[-5]) self.assertRaises(IndexError, lambda: items[-5])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment