summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_index.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2007-08-30 22:57:53 (GMT)
committerThomas Wouters <thomas@python.org>2007-08-30 22:57:53 (GMT)
commitd2cf20eea2338a0369d4a5707adb01b201f7dfb2 (patch)
tree59fd4a094906997ae2b0cd520ff09010457da680 /Lib/test/test_index.py
parent582b5866174d20f7c027cbb6fb757fefb382f96f (diff)
downloadcpython-d2cf20eea2338a0369d4a5707adb01b201f7dfb2.zip
cpython-d2cf20eea2338a0369d4a5707adb01b201f7dfb2.tar.gz
cpython-d2cf20eea2338a0369d4a5707adb01b201f7dfb2.tar.bz2
Remove the simple slicing API. All slicing is now done with slice objects.
Diffstat (limited to 'Lib/test/test_index.py')
-rw-r--r--Lib/test/test_index.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 653665e..6275e12 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -177,26 +177,17 @@ class OverflowTestCase(unittest.TestCase):
self.assertEqual(self.pos.__index__(), self.pos)
self.assertEqual(self.neg.__index__(), self.neg)
- def _getitem_helper(self, base):
- class GetItem(base):
+ def test_getitem(self):
+ class GetItem(object):
def __len__(self):
return maxint #cannot return long here
def __getitem__(self, key):
return key
- def __getslice__(self, i, j):
- return i, j
x = GetItem()
self.assertEqual(x[self.pos], self.pos)
self.assertEqual(x[self.neg], self.neg)
- self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize))
- self.assertEqual(x[self.neg:self.pos:1].indices(maxsize), (0, maxsize, 1))
-
- def test_getitem(self):
- self._getitem_helper(object)
-
- def test_getitem_classic(self):
- class Empty: pass
- self._getitem_helper(Empty)
+ self.assertEqual(x[self.neg:self.pos].indices(maxsize),
+ (0, maxsize, 1))
def test_sequence_repeat(self):
self.failUnlessRaises(OverflowError, lambda: "a" * self.pos)