Merging change 55102 from the trunk:

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.
This commit is contained in:
Kristján Valur Jónsson 2007-05-07 13:33:39 +00:00
parent 4e6b5e9ead
commit 7bca027f64
4 changed files with 17 additions and 10 deletions

View file

@ -5,6 +5,8 @@ from weakref import proxy
import sys
import operator
import random
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize-1
def onearg(x):
'Test function of one argument'
@ -52,7 +54,7 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)])
self.assertRaises(TypeError, count, 2, 3)
self.assertRaises(TypeError, count, 'a')
self.assertRaises(OverflowError, list, islice(count(sys.maxint-5), 10))
self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10))
c = count(3)
self.assertEqual(repr(c), 'count(3)')
c.next()
@ -285,7 +287,7 @@ class TestBasicOps(unittest.TestCase):
self.assertRaises(ValueError, islice, xrange(10), 1, 'a')
self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1)
self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1)
self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1)
self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1)
def test_takewhile(self):
data = [1, 3, 5, 20, 2, 4, 6, 8]