Commit 23e7bd75 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 47fb1d59
......@@ -212,7 +212,7 @@ class MappingBase(Base):
self.t[i] = i
L.sort()
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.assertRaises(IndexError, lambda: vals[-5])
......@@ -241,7 +241,7 @@ class MappingBase(Base):
self.t[i] = i
L.sort()
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.assertRaises(IndexError, lambda: keys[-5])
......@@ -273,7 +273,7 @@ class MappingBase(Base):
self.t[i] = i
L.sort()
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.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