summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_index.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2007-05-03 20:09:56 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2007-05-03 20:09:56 (GMT)
commit170eee9d6ae4ad4270cfd164c046c2381d746191 (patch)
tree75570ad8d2a1b630046f6753a6a7fd2c2c11a17c /Lib/test/test_index.py
parent19ac472ba12c41e201b91a45e21ebc0b079d3ca1 (diff)
downloadcpython-170eee9d6ae4ad4270cfd164c046c2381d746191.zip
cpython-170eee9d6ae4ad4270cfd164c046c2381d746191.tar.gz
cpython-170eee9d6ae4ad4270cfd164c046c2381d746191.tar.bz2
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
Diffstat (limited to 'Lib/test/test_index.py')
-rw-r--r--Lib/test/test_index.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index ecb566d..323b37b 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -1,7 +1,10 @@
import unittest
from test import test_support
import operator
+import sys
from sys import maxint
+maxsize = test_support.MAX_Py_ssize_t
+minsize = -maxsize-1
class oldstyle:
def __index__(self):
@@ -185,7 +188,7 @@ class OverflowTestCase(unittest.TestCase):
def _getitem_helper(self, base):
class GetItem(base):
def __len__(self):
- return maxint
+ return maxint #cannot return long here
def __getitem__(self, key):
return key
def __getslice__(self, i, j):
@@ -193,8 +196,8 @@ class OverflowTestCase(unittest.TestCase):
x = GetItem()
self.assertEqual(x[self.pos], self.pos)
self.assertEqual(x[self.neg], self.neg)
- self.assertEqual(x[self.neg:self.pos], (-1, maxint))
- self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1))
+ 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)