summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/buffer_tests.py4
-rw-r--r--Lib/test/list_tests.py4
-rw-r--r--Lib/test/pickletester.py2
-rwxr-xr-xLib/test/regrtest.py2
-rw-r--r--Lib/test/string_tests.py36
-rw-r--r--Lib/test/test_builtin.py38
-rw-r--r--Lib/test/test_bytes.py22
-rw-r--r--Lib/test/test_compile.py12
-rw-r--r--Lib/test/test_descr.py4
-rw-r--r--Lib/test/test_format.py2
-rw-r--r--Lib/test/test_grammar.py8
-rw-r--r--Lib/test/test_hexoct.py2
-rw-r--r--Lib/test/test_index.py3
-rw-r--r--Lib/test/test_itertools.py2
-rw-r--r--Lib/test/test_list.py2
-rw-r--r--Lib/test/test_long.py32
-rw-r--r--Lib/test/test_marshal.py6
-rw-r--r--Lib/test/test_multibytecodec.py2
-rw-r--r--Lib/test/test_multibytecodec_support.py2
-rw-r--r--Lib/test/test_range.py6
-rw-r--r--Lib/test/test_slice.py2
-rw-r--r--Lib/test/test_struct.py4
-rw-r--r--Lib/test/test_sys.py2
-rw-r--r--Lib/test/test_threading.py2
-rw-r--r--Lib/test/test_types.py6
-rw-r--r--Lib/test/test_unicode.py4
-rw-r--r--Lib/test/test_xmlrpc.py2
27 files changed, 106 insertions, 107 deletions
diff --git a/Lib/test/buffer_tests.py b/Lib/test/buffer_tests.py
index db27759..8696eab 100644
--- a/Lib/test/buffer_tests.py
+++ b/Lib/test/buffer_tests.py
@@ -172,9 +172,9 @@ class MixinBytesBufferCommonTests(object):
self.assertRaises(TypeError, self.marshal(b'hello').expandtabs, 42, 42)
# This test is only valid when sizeof(int) == sizeof(void*) == 4.
- if sys.maxint < (1 << 32) and struct.calcsize('P') == 4:
+ if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4:
self.assertRaises(OverflowError,
- self.marshal(b'\ta\n\tb').expandtabs, sys.maxint)
+ self.marshal(b'\ta\n\tb').expandtabs, sys.maxsize)
def test_title(self):
self.assertEqual(b' Hello ', self.marshal(b' hello ').title())
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 2c961ce..4317316 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -388,8 +388,8 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(a.index(0, -3), 3)
self.assertEqual(a.index(0, 3, 4), 3)
self.assertEqual(a.index(0, -3, -2), 3)
- self.assertEqual(a.index(0, -4*sys.maxint, 4*sys.maxint), 2)
- self.assertRaises(ValueError, a.index, 0, 4*sys.maxint,-4*sys.maxint)
+ self.assertEqual(a.index(0, -4*sys.maxsize, 4*sys.maxsize), 2)
+ self.assertRaises(ValueError, a.index, 0, 4*sys.maxsize,-4*sys.maxsize)
self.assertRaises(ValueError, a.index, 2, 0, -10)
a.remove(0)
self.assertRaises(ValueError, a.index, 2, 0, 4)
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index b20f599..5ac2bdc 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -493,7 +493,7 @@ class AbstractPickleTests(unittest.TestCase):
def test_ints(self):
import sys
for proto in protocols:
- n = sys.maxint
+ n = sys.maxsize
while n:
for expected in (-n, n):
s = self.dumps(expected, proto)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index f4569ab..16f4d3d 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -140,7 +140,7 @@ import traceback
# putting them in test_grammar.py has no effect:
warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,
".*test.test_grammar$")
-if sys.maxint > 0x7fffffff:
+if sys.maxsize > 0x7fffffff:
# Also suppress them in <string>, because for 64-bit platforms,
# that's where test_grammar.py hides them.
warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 909f947..80fe475 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -265,9 +265,9 @@ class BaseTest(unittest.TestCase):
self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42)
# This test is only valid when sizeof(int) == sizeof(void*) == 4.
- if sys.maxint < (1 << 32) and struct.calcsize('P') == 4:
+ if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4:
self.checkraises(OverflowError,
- '\ta\n\tb', 'expandtabs', sys.maxint)
+ '\ta\n\tb', 'expandtabs', sys.maxsize)
def test_split(self):
# by a char
@@ -278,7 +278,7 @@ class BaseTest(unittest.TestCase):
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|',
- sys.maxint-2)
+ sys.maxsize-2)
self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0)
self.checkequal(['a', '', 'b||c||d'], 'a||b||c||d', 'split', '|', 2)
self.checkequal(['endcase ', ''], 'endcase |', 'split', '|')
@@ -297,7 +297,7 @@ class BaseTest(unittest.TestCase):
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//',
- sys.maxint-10)
+ sys.maxsize-10)
self.checkequal(['a//b//c//d'], 'a//b//c//d', 'split', '//', 0)
self.checkequal(['a', '', 'b////c////d'], 'a////b////c////d', 'split', '//', 2)
self.checkequal(['endcase ', ''], 'endcase test', 'split', 'test')
@@ -334,7 +334,7 @@ class BaseTest(unittest.TestCase):
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|',
- sys.maxint-100)
+ sys.maxsize-100)
self.checkequal(['a|b|c|d'], 'a|b|c|d', 'rsplit', '|', 0)
self.checkequal(['a||b||c', '', 'd'], 'a||b||c||d', 'rsplit', '|', 2)
self.checkequal(['', ' begincase'], '| begincase', 'rsplit', '|')
@@ -354,7 +354,7 @@ class BaseTest(unittest.TestCase):
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//',
- sys.maxint-5)
+ sys.maxsize-5)
self.checkequal(['a//b//c//d'], 'a//b//c//d', 'rsplit', '//', 0)
self.checkequal(['a////b////c', '', 'd'], 'a////b////c////d', 'rsplit', '//', 2)
self.checkequal(['', ' begincase'], 'test begincase', 'rsplit', 'test')
@@ -392,7 +392,7 @@ class BaseTest(unittest.TestCase):
EQ("", "", "replace", "A", "")
EQ("", "", "replace", "A", "A")
EQ("", "", "replace", "", "", 100)
- EQ("", "", "replace", "", "", sys.maxint)
+ EQ("", "", "replace", "", "", sys.maxsize)
# interleave (from=="", 'to' gets inserted everywhere)
EQ("A", "A", "replace", "", "")
@@ -401,7 +401,7 @@ class BaseTest(unittest.TestCase):
EQ("*-#A*-#", "A", "replace", "", "*-#")
EQ("*-A*-A*-", "AA", "replace", "", "*-")
EQ("*-A*-A*-", "AA", "replace", "", "*-", -1)
- EQ("*-A*-A*-", "AA", "replace", "", "*-", sys.maxint)
+ EQ("*-A*-A*-", "AA", "replace", "", "*-", sys.maxsize)
EQ("*-A*-A*-", "AA", "replace", "", "*-", 4)
EQ("*-A*-A*-", "AA", "replace", "", "*-", 3)
EQ("*-A*-A", "AA", "replace", "", "*-", 2)
@@ -412,7 +412,7 @@ class BaseTest(unittest.TestCase):
EQ("", "A", "replace", "A", "")
EQ("", "AAA", "replace", "A", "")
EQ("", "AAA", "replace", "A", "", -1)
- EQ("", "AAA", "replace", "A", "", sys.maxint)
+ EQ("", "AAA", "replace", "A", "", sys.maxsize)
EQ("", "AAA", "replace", "A", "", 4)
EQ("", "AAA", "replace", "A", "", 3)
EQ("A", "AAA", "replace", "A", "", 2)
@@ -421,7 +421,7 @@ class BaseTest(unittest.TestCase):
EQ("", "AAAAAAAAAA", "replace", "A", "")
EQ("BCD", "ABACADA", "replace", "A", "")
EQ("BCD", "ABACADA", "replace", "A", "", -1)
- EQ("BCD", "ABACADA", "replace", "A", "", sys.maxint)
+ EQ("BCD", "ABACADA", "replace", "A", "", sys.maxsize)
EQ("BCD", "ABACADA", "replace", "A", "", 5)
EQ("BCD", "ABACADA", "replace", "A", "", 4)
EQ("BCDA", "ABACADA", "replace", "A", "", 3)
@@ -444,7 +444,7 @@ class BaseTest(unittest.TestCase):
EQ("thaet", "thaet", "replace", "the", "")
EQ("here and re", "here and there", "replace", "the", "")
EQ("here and re and re", "here and there and there",
- "replace", "the", "", sys.maxint)
+ "replace", "the", "", sys.maxsize)
EQ("here and re and re", "here and there and there",
"replace", "the", "", -1)
EQ("here and re and re", "here and there and there",
@@ -469,7 +469,7 @@ class BaseTest(unittest.TestCase):
# single character replace in place (len(from)==len(to)==1)
EQ("Who goes there?", "Who goes there?", "replace", "o", "o")
EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O")
- EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", sys.maxint)
+ EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", sys.maxsize)
EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", -1)
EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 3)
EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 2)
@@ -486,7 +486,7 @@ class BaseTest(unittest.TestCase):
# substring replace in place (len(from)==len(to) > 1)
EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**")
- EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", sys.maxint)
+ EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", sys.maxsize)
EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", -1)
EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 4)
EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 3)
@@ -500,7 +500,7 @@ class BaseTest(unittest.TestCase):
# replace single character (len(from)==1, len(to)>1)
EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK")
EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", -1)
- EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", sys.maxint)
+ EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", sys.maxsize)
EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", 2)
EQ("ReyKKjavik", "Reykjavik", "replace", "k", "KK", 1)
EQ("Reykjavik", "Reykjavik", "replace", "k", "KK", 0)
@@ -512,7 +512,7 @@ class BaseTest(unittest.TestCase):
EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam",
"replace", "spam", "ham")
EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam",
- "replace", "spam", "ham", sys.maxint)
+ "replace", "spam", "ham", sys.maxsize)
EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam",
"replace", "spam", "ham", -1)
EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam",
@@ -567,7 +567,7 @@ class BaseTest(unittest.TestCase):
def test_replace_overflow(self):
# Check for overflow checking on 32 bit machines
- if sys.maxint != 2147483647 or struct.calcsize("P") > 4:
+ if sys.maxsize != 2147483647 or struct.calcsize("P") > 4:
return
A2_16 = "A" * (2**16)
self.checkraises(OverflowError, A2_16, "replace", "", A2_16)
@@ -631,7 +631,7 @@ class CommonTest(BaseTest):
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None,
- sys.maxint-1)
+ sys.maxsize-1)
self.checkequal(['a b c d'], 'a b c d', 'split', None, 0)
self.checkequal(['a b c d'], ' a b c d', 'split', None, 0)
self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
@@ -662,7 +662,7 @@ class CommonTest(BaseTest):
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3)
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4)
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None,
- sys.maxint-20)
+ sys.maxsize-20)
self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0)
self.checkequal(['a b c d'], 'a b c d ', 'rsplit', None, 0)
self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index d543751..be6f391 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -60,7 +60,7 @@ L = [
(' 314', 314),
('314 ', 314),
(' \t\t 314 \t\t ', 314),
- (repr(sys.maxint), sys.maxint),
+ (repr(sys.maxsize), sys.maxsize),
(' 1x', ValueError),
(' 1 ', 1),
(' 1\02 ', ValueError),
@@ -97,7 +97,7 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(abs(0), 0)
self.assertEqual(abs(1234), 1234)
self.assertEqual(abs(-1234), 1234)
- self.assertTrue(abs(-sys.maxint-1) > 0)
+ self.assertTrue(abs(-sys.maxsize-1) > 0)
# float
self.assertEqual(abs(0.0), 0.0)
self.assertEqual(abs(3.14), 3.14)
@@ -138,9 +138,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(any(x > 42 for x in S), False)
def test_neg(self):
- x = -sys.maxint-1
+ x = -sys.maxsize-1
self.assert_(isinstance(x, int))
- self.assertEqual(-x, sys.maxint+1)
+ self.assertEqual(-x, sys.maxsize+1)
# XXX(nnorwitz): This test case for callable should probably be removed.
def test_callable(self):
@@ -306,8 +306,8 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(divmod(12, -7), (-2, -2))
self.assertEqual(divmod(-12, -7), (1, -5))
- self.assertEqual(divmod(-sys.maxint-1, -1),
- (sys.maxint+1, 0))
+ self.assertEqual(divmod(-sys.maxsize-1, -1),
+ (sys.maxsize+1, 0))
self.assert_(not fcmp(divmod(3.25, 1.0), (3.0, 0.25)))
self.assert_(not fcmp(divmod(-3.25, 1.0), (-4.0, 0.75)))
@@ -644,12 +644,12 @@ class BuiltinTest(unittest.TestCase):
except v:
pass
- s = repr(-1-sys.maxint)
+ s = repr(-1-sys.maxsize)
x = int(s)
- self.assertEqual(x+1, -sys.maxint)
+ self.assertEqual(x+1, -sys.maxsize)
self.assert_(isinstance(x, int))
# should return long
- self.assertEqual(int(s[1:]), sys.maxint+1)
+ self.assertEqual(int(s[1:]), sys.maxsize+1)
# should return long
x = int(1e100)
@@ -661,7 +661,7 @@ class BuiltinTest(unittest.TestCase):
# SF bug 434186: 0x80000000/2 != 0x80000000>>1.
# Worked by accident in Windows release build, but failed in debug build.
# Failed in all Linux builds.
- x = -1-sys.maxint
+ x = -1-sys.maxsize
self.assertEqual(x >> 1, x//2)
self.assertRaises(ValueError, int, '123\0')
@@ -881,12 +881,12 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(list(''), [])
self.assertEqual(list('spam'), ['s', 'p', 'a', 'm'])
- if sys.maxint == 0x7fffffff:
+ if sys.maxsize == 0x7fffffff:
# This test can currently only work on 32-bit machines.
# XXX If/when PySequence_Length() returns a ssize_t, it should be
# XXX re-enabled.
# Verify clearing of bug #556025.
- # This assumes that the max data size (sys.maxint) == max
+ # This assumes that the max data size (sys.maxsize) == max
# address size this also assumes that the address size is at
# least 4 bytes with 8 byte addresses, the bug is not well
# tested
@@ -896,7 +896,7 @@ class BuiltinTest(unittest.TestCase):
# thread for the details:
# http://sources.redhat.com/ml/newlib/2002/msg00369.html
- self.assertRaises(MemoryError, list, range(sys.maxint // 2))
+ self.assertRaises(MemoryError, list, range(sys.maxsize // 2))
# This code used to segfault in Py2.4a3
x = []
@@ -1384,9 +1384,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(list(range(0, 2**100, -1)), [])
self.assertEqual(list(range(0, 2**100, -1)), [])
- a = int(10 * sys.maxint)
- b = int(100 * sys.maxint)
- c = int(50 * sys.maxint)
+ a = int(10 * sys.maxsize)
+ b = int(100 * sys.maxsize)
+ c = int(50 * sys.maxsize)
self.assertEqual(list(range(a, a+2)), [a, a+1])
self.assertEqual(list(range(a+2, a, -1)), [a+2, a+1])
@@ -1428,10 +1428,10 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(TypeError, range, 0, "spam")
self.assertRaises(TypeError, range, 0, 42, "spam")
- #NEAL self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint)
- #NEAL self.assertRaises(OverflowError, range, 0, 2*sys.maxint)
+ #NEAL self.assertRaises(OverflowError, range, -sys.maxsize, sys.maxsize)
+ #NEAL self.assertRaises(OverflowError, range, 0, 2*sys.maxsize)
- self.assertRaises(OverflowError, len, range(0, sys.maxint**10))
+ self.assertRaises(OverflowError, len, range(0, sys.maxsize**10))
def test_input(self):
self.write_testfile()
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index f037d4c..0fd2f76 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -36,14 +36,14 @@ class BytesTest(unittest.TestCase):
self.assertEqual(len(b), 0)
self.assertRaises(IndexError, lambda: b[0])
self.assertRaises(IndexError, lambda: b[1])
- self.assertRaises(IndexError, lambda: b[sys.maxint])
- self.assertRaises(IndexError, lambda: b[sys.maxint+1])
+ self.assertRaises(IndexError, lambda: b[sys.maxsize])
+ self.assertRaises(IndexError, lambda: b[sys.maxsize+1])
self.assertRaises(IndexError, lambda: b[10**100])
self.assertRaises(IndexError, lambda: b[-1])
self.assertRaises(IndexError, lambda: b[-2])
- self.assertRaises(IndexError, lambda: b[-sys.maxint])
- self.assertRaises(IndexError, lambda: b[-sys.maxint-1])
- self.assertRaises(IndexError, lambda: b[-sys.maxint-2])
+ self.assertRaises(IndexError, lambda: b[-sys.maxsize])
+ self.assertRaises(IndexError, lambda: b[-sys.maxsize-1])
+ self.assertRaises(IndexError, lambda: b[-sys.maxsize-2])
self.assertRaises(IndexError, lambda: b[-10**100])
def test_from_list(self):
@@ -83,14 +83,14 @@ class BytesTest(unittest.TestCase):
def test_constructor_value_errors(self):
self.assertRaises(ValueError, bytearray, [-1])
- self.assertRaises(ValueError, bytearray, [-sys.maxint])
- self.assertRaises(ValueError, bytearray, [-sys.maxint-1])
- self.assertRaises(ValueError, bytearray, [-sys.maxint-2])
+ self.assertRaises(ValueError, bytearray, [-sys.maxsize])
+ self.assertRaises(ValueError, bytearray, [-sys.maxsize-1])
+ self.assertRaises(ValueError, bytearray, [-sys.maxsize-2])
self.assertRaises(ValueError, bytearray, [-10**100])
self.assertRaises(ValueError, bytearray, [256])
self.assertRaises(ValueError, bytearray, [257])
- self.assertRaises(ValueError, bytearray, [sys.maxint])
- self.assertRaises(ValueError, bytearray, [sys.maxint+1])
+ self.assertRaises(ValueError, bytearray, [sys.maxsize])
+ self.assertRaises(ValueError, bytearray, [sys.maxsize+1])
self.assertRaises(ValueError, bytearray, [10**100])
def test_repr_str(self):
@@ -412,7 +412,7 @@ class BytesTest(unittest.TestCase):
self.assertRaises(TypeError, lambda: 3.14 * b)
# XXX Shouldn't bytes and bytearray agree on what to raise?
self.assertRaises((OverflowError, MemoryError),
- lambda: b * sys.maxint)
+ lambda: b * sys.maxsize)
def test_repeat_1char(self):
self.assertEqual(b'x'*100, bytearray([ord('x')]*100))
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index cc490d7..4979f92 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -194,24 +194,24 @@ if 1:
def test_unary_minus(self):
# Verify treatment of unary minus on negative numbers SF bug #660455
- if sys.maxint == 2147483647:
+ if sys.maxsize == 2147483647:
# 32-bit machine
all_one_bits = '0xffffffff'
self.assertEqual(eval(all_one_bits), 4294967295)
self.assertEqual(eval("-" + all_one_bits), -4294967295)
- elif sys.maxint == 9223372036854775807:
+ elif sys.maxsize == 9223372036854775807:
# 64-bit machine
all_one_bits = '0xffffffffffffffff'
self.assertEqual(eval(all_one_bits), 18446744073709551615)
self.assertEqual(eval("-" + all_one_bits), -18446744073709551615)
else:
self.fail("How many bits *does* this machine have???")
- # Verify treatment of contant folding on -(sys.maxint+1)
+ # Verify treatment of contant folding on -(sys.maxsize+1)
# i.e. -2147483648 on 32 bit platforms. Should return int, not long.
- self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 1)), int))
- self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 2)), int))
+ self.assertTrue(isinstance(eval("%s" % (-sys.maxsize - 1)), int))
+ self.assertTrue(isinstance(eval("%s" % (-sys.maxsize - 2)), int))
- if sys.maxint == 9223372036854775807:
+ if sys.maxsize == 9223372036854775807:
def test_32_63_bit_values(self):
a = +4294967296 # 1 << 32
b = -4294967296 # 1 << 32
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index aa01805..199a49c 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4118,8 +4118,8 @@ def notimplemented():
else:
raise TestFailed("no TypeError from %r" % (expr,))
- N1 = sys.maxint + 1 # might trigger OverflowErrors instead of TypeErrors
- N2 = sys.maxint # if sizeof(int) < sizeof(long), might trigger
+ N1 = sys.maxsize + 1 # might trigger OverflowErrors instead of TypeErrors
+ N2 = sys.maxsize # if sizeof(int) < sizeof(long), might trigger
# ValueErrors instead of TypeErrors
if 1:
metaclass = type
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 0b02adf..9f4528c 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -40,7 +40,7 @@ def testformat(formatstr, args, output=None):
print('yes')
testformat("%.1d", (1,), "1")
-testformat("%.*d", (sys.maxint,1)) # expect overflow
+testformat("%.*d", (sys.maxsize,1)) # expect overflow
testformat("%.100d", (1,), '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001')
testformat("%#.117x", (1,), '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001')
testformat("%#.118x", (1,), '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001')
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index ee3ffc7..7ab7557 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -32,8 +32,8 @@ class TokenTests(unittest.TestCase):
self.assertEquals(0o377, 255)
self.assertEquals(2147483647, 0o17777777777)
self.assertEquals(0b1001, 9)
- from sys import maxint
- if maxint == 2147483647:
+ from sys import maxsize
+ if maxsize == 2147483647:
self.assertEquals(-2147483647-1, -0o20000000000)
# XXX -2147483648
self.assert_(0o37777777777 > 0)
@@ -45,7 +45,7 @@ class TokenTests(unittest.TestCase):
x = eval(s)
except OverflowError:
self.fail("OverflowError on huge integer literal %r" % s)
- elif maxint == 9223372036854775807:
+ elif maxsize == 9223372036854775807:
self.assertEquals(-9223372036854775807-1, -0o1000000000000000000000)
self.assert_(0o1777777777777777777777 > 0)
self.assert_(0xffffffffffffffff > 0)
@@ -58,7 +58,7 @@ class TokenTests(unittest.TestCase):
except OverflowError:
self.fail("OverflowError on huge integer literal %r" % s)
else:
- self.fail('Weird maxint value %r' % maxint)
+ self.fail('Weird maxsize value %r' % maxsize)
def testLongIntegers(self):
x = 0
diff --git a/Lib/test/test_hexoct.py b/Lib/test/test_hexoct.py
index afd696a..df9b310 100644
--- a/Lib/test/test_hexoct.py
+++ b/Lib/test/test_hexoct.py
@@ -4,7 +4,7 @@ This is complex because of changes due to PEP 237.
"""
import sys
-platform_long_is_32_bits = sys.maxint == 2147483647
+platform_long_is_32_bits = sys.maxsize == 2147483647
import unittest
from test import test_support
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 6275e12..9a22020 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -2,7 +2,6 @@ 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
@@ -180,7 +179,7 @@ class OverflowTestCase(unittest.TestCase):
def test_getitem(self):
class GetItem(object):
def __len__(self):
- return maxint #cannot return long here
+ return sys.maxsize
def __getitem__(self, key):
return key
x = GetItem()
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 81e2e8e..17e0058 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -71,7 +71,7 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(repr(c), 'count(-9)')
next(c)
self.assertEqual(next(c), -8)
- for i in (-sys.maxint-5, -sys.maxint+5 ,-10, -1, 0, 10, sys.maxint-5, sys.maxint+5):
+ for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
# Test repr (ignoring the L in longs)
r1 = repr(count(i)).replace('L', '')
r2 = 'count(%r)'.__mod__(i).replace('L', '')
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 2afb3e9..5b84a42 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -21,7 +21,7 @@ class ListTest(list_tests.CommonTest):
def test_overflow(self):
lst = [4, 5, 6, 7]
- n = int((sys.maxint*2+2) // len(lst))
+ n = int((sys.maxsize*2+2) // len(lst))
def mul(a, b): return a * b
def imul(a, b): a *= b
self.assertRaises((MemoryError, OverflowError), mul, lst, n)
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index bdda5d8..8be8bff 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -233,48 +233,48 @@ class LongTest(unittest.TestCase):
import sys
# check the extremes in int<->long conversion
- hugepos = sys.maxint
+ hugepos = sys.maxsize
hugeneg = -hugepos - 1
hugepos_aslong = int(hugepos)
hugeneg_aslong = int(hugeneg)
- self.assertEqual(hugepos, hugepos_aslong, "long(sys.maxint) != sys.maxint")
+ self.assertEqual(hugepos, hugepos_aslong, "long(sys.maxsize) != sys.maxsize")
self.assertEqual(hugeneg, hugeneg_aslong,
- "long(-sys.maxint-1) != -sys.maxint-1")
+ "long(-sys.maxsize-1) != -sys.maxsize-1")
# long -> int should not fail for hugepos_aslong or hugeneg_aslong
x = int(hugepos_aslong)
try:
self.assertEqual(x, hugepos,
- "converting sys.maxint to long and back to int fails")
+ "converting sys.maxsize to long and back to int fails")
except OverflowError:
- self.fail("int(long(sys.maxint)) overflowed!")
+ self.fail("int(long(sys.maxsize)) overflowed!")
if not isinstance(x, int):
- raise TestFailed("int(long(sys.maxint)) should have returned int")
+ raise TestFailed("int(long(sys.maxsize)) should have returned int")
x = int(hugeneg_aslong)
try:
self.assertEqual(x, hugeneg,
- "converting -sys.maxint-1 to long and back to int fails")
+ "converting -sys.maxsize-1 to long and back to int fails")
except OverflowError:
- self.fail("int(long(-sys.maxint-1)) overflowed!")
+ self.fail("int(long(-sys.maxsize-1)) overflowed!")
if not isinstance(x, int):
- raise TestFailed("int(long(-sys.maxint-1)) should have "
+ raise TestFailed("int(long(-sys.maxsize-1)) should have "
"returned int")
# but long -> int should overflow for hugepos+1 and hugeneg-1
x = hugepos_aslong + 1
try:
y = int(x)
except OverflowError:
- self.fail("int(long(sys.maxint) + 1) mustn't overflow")
+ self.fail("int(long(sys.maxsize) + 1) mustn't overflow")
self.assert_(isinstance(y, int),
- "int(long(sys.maxint) + 1) should have returned long")
+ "int(long(sys.maxsize) + 1) should have returned long")
x = hugeneg_aslong - 1
try:
y = int(x)
except OverflowError:
- self.fail("int(long(-sys.maxint-1) - 1) mustn't overflow")
+ self.fail("int(long(-sys.maxsize-1) - 1) mustn't overflow")
self.assert_(isinstance(y, int),
- "int(long(-sys.maxint-1) - 1) should have returned long")
+ "int(long(-sys.maxsize-1) - 1) should have returned long")
class long2(int):
pass
@@ -288,8 +288,8 @@ class LongTest(unittest.TestCase):
def test_auto_overflow(self):
import math, sys
- special = [0, 1, 2, 3, sys.maxint-1, sys.maxint, sys.maxint+1]
- sqrt = int(math.sqrt(sys.maxint))
+ special = [0, 1, 2, 3, sys.maxsize-1, sys.maxsize, sys.maxsize+1]
+ sqrt = int(math.sqrt(sys.maxsize))
special.extend([sqrt-1, sqrt, sqrt+1])
special.extend([-i for i in special])
@@ -462,7 +462,7 @@ class LongTest(unittest.TestCase):
for t in 2.0**48, 2.0**50, 2.0**53:
cases.extend([t - 1.0, t - 0.3, t, t + 0.3, t + 1.0,
int(t-1), int(t), int(t+1)])
- cases.extend([0, 1, 2, sys.maxint, float(sys.maxint)])
+ cases.extend([0, 1, 2, sys.maxsize, float(sys.maxsize)])
# 1L<<20000 should exceed all double formats. long(1e200) is to
# check that we get equality with 1e200 above.
t = int(1e200)
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index d14d50d..66545e0 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -28,7 +28,7 @@ class HelperMixin:
class IntTestCase(unittest.TestCase, HelperMixin):
def test_ints(self):
# Test the full range of Python ints.
- n = sys.maxint
+ n = sys.maxsize
while n:
for expected in (-n, n):
self.helper(expected)
@@ -66,7 +66,7 @@ class FloatTestCase(unittest.TestCase, HelperMixin):
def test_floats(self):
# Test a few floats
small = 1e-25
- n = sys.maxint * 3.7e250
+ n = sys.maxsize * 3.7e250
while n > small:
for expected in (-n, n):
self.helper(float(expected))
@@ -81,7 +81,7 @@ class FloatTestCase(unittest.TestCase, HelperMixin):
got = marshal.loads(s)
self.assertEqual(f, got)
- n = sys.maxint * 3.7e-250
+ n = sys.maxsize * 3.7e-250
while n < small:
for expected in (-n, n):
f = float(expected)
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index e9d3ef0..615ad8b 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -40,7 +40,7 @@ class Test_MultibyteCodec(unittest.TestCase):
def test_errorcallback_longindex(self):
dec = codecs.getdecoder('euc-kr')
- myreplace = lambda exc: ('', sys.maxint+1)
+ myreplace = lambda exc: ('', sys.maxsize+1)
codecs.register_error('test.cjktest', myreplace)
self.assertRaises(IndexError, dec,
'apple\x92ham\x93spam', 'test.cjktest')
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 957b9fc..6b67057 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -114,7 +114,7 @@ class TestBase:
'test.cjktest'), (b'abcdxefgh', 9))
def myreplace(exc):
- return ('x', sys.maxint + 1)
+ return ('x', sys.maxsize + 1)
codecs.register_error("test.cjktest", myreplace)
self.assertRaises(IndexError, self.encode, self.unmappedunicode,
'test.cjktest')
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
index 0a4c9a0..dedf007 100644
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -51,10 +51,10 @@ class RangeTest(unittest.TestCase):
self.assertRaises(TypeError, range, 0, "spam")
self.assertRaises(TypeError, range, 0, 42, "spam")
- self.assertEqual(len(range(0, sys.maxint, sys.maxint-1)), 2)
+ self.assertEqual(len(range(0, sys.maxsize, sys.maxsize-1)), 2)
- r = range(-sys.maxint, sys.maxint, 2)
- self.assertEqual(len(r), sys.maxint)
+ r = range(-sys.maxsize, sys.maxsize, 2)
+ self.assertEqual(len(r), sys.maxsize)
def test_repr(self):
self.assertEqual(repr(range(1)), 'range(0, 1)')
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index cb9d8b2..20d2027 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -92,7 +92,7 @@ class SliceTest(unittest.TestCase):
)
self.assertEqual(slice(-100, 100, 2).indices(10), (0, 10, 2))
- self.assertEqual(list(range(10))[::sys.maxint - 1], [0])
+ self.assertEqual(list(range(10))[::sys.maxsize - 1], [0])
self.assertRaises(OverflowError, slice(None).indices, 1<<100)
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 34596e0..23358be 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -506,8 +506,8 @@ def test_1229380():
deprecated_err(struct.pack, endian + 'B', 300)
deprecated_err(struct.pack, endian + 'H', 70000)
- deprecated_err(struct.pack, endian + 'I', sys.maxint * 4)
- deprecated_err(struct.pack, endian + 'L', sys.maxint * 4)
+ deprecated_err(struct.pack, endian + 'I', sys.maxsize * 4)
+ deprecated_err(struct.pack, endian + 'L', sys.maxsize * 4)
if PY_STRUCT_RANGE_CHECKING:
test_1229380()
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 435a696..0a62c01 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -282,7 +282,7 @@ class SysModuleTest(unittest.TestCase):
self.assert_(isinstance(sys.float_info, dict))
self.assertEqual(len(sys.float_info), 11)
self.assert_(isinstance(sys.hexversion, int))
- self.assert_(isinstance(sys.maxint, int))
+ self.assert_(isinstance(sys.maxsize, int))
self.assert_(isinstance(sys.maxunicode, int))
self.assert_(isinstance(sys.platform, str))
self.assert_(isinstance(sys.prefix, str))
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index e5ed201..5dd3aea 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -258,7 +258,7 @@ class ThreadingExceptionTests(unittest.TestCase):
def test_semaphore_with_negative_value(self):
self.assertRaises(ValueError, threading.Semaphore, value = -1)
- self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint)
+ self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxsize)
def test_joining_current_thread(self):
currentThread = threading.currentThread()
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 70c281f..0014323 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -105,7 +105,7 @@ class TypesTests(unittest.TestCase):
if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912):
self.fail('int mul commutativity')
# And another.
- m = -sys.maxint - 1
+ m = -sys.maxsize - 1
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor
prod = divisor * j
@@ -122,7 +122,7 @@ class TypesTests(unittest.TestCase):
self.fail("expected type(%r) to be long, not %r" %
(prod, type(prod)))
# Check for expected * overflow to long.
- m = sys.maxint
+ m = sys.maxsize
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor + 1
prod = divisor * j
@@ -137,7 +137,7 @@ class TypesTests(unittest.TestCase):
if (-12) + (-24) != -36: self.fail('long op')
if not 12 < 24: self.fail('long op')
if not -24 < -12: self.fail('long op')
- x = sys.maxint
+ x = sys.maxsize
if int(int(x)) != x: self.fail('long op')
try: y = int(int(x)+1)
except OverflowError: self.fail('long op')
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index fe4eb85..eed8492 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1055,9 +1055,9 @@ class UnicodeTest(
# This test only affects 32-bit platforms because expandtabs can only take
# an int as the max value, not a 64-bit C long. If expandtabs is changed
# to take a 64-bit long, this test should apply to all platforms.
- if sys.maxint > (1 << 32) or struct.calcsize('P') != 4:
+ if sys.maxsize > (1 << 32) or struct.calcsize('P') != 4:
return
- self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxint)
+ self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
def test_main():
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index e54ca19..2674716 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -117,7 +117,7 @@ class XMLRPCTestCase(unittest.TestCase):
self.assertRaises(TypeError, xmlrpclib.dumps, (d,))
def test_dump_big_int(self):
- if sys.maxint > 2**31-1:
+ if sys.maxsize > 2**31-1:
self.assertRaises(OverflowError, xmlrpclib.dumps,
(int(2**34),))