summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-15 16:59:06 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-15 16:59:06 (GMT)
commite2a383d062434c05b73031f0da57fe82b9da8942 (patch)
tree1a6fb6b2c056a10ee227dbc75855b3fac6153414 /Lib/test
parentfc7bb8c786fd9cb3b1ab84e1976620d0ab545777 (diff)
downloadcpython-e2a383d062434c05b73031f0da57fe82b9da8942.zip
cpython-e2a383d062434c05b73031f0da57fe82b9da8942.tar.gz
cpython-e2a383d062434c05b73031f0da57fe82b9da8942.tar.bz2
Rip out 'long' and 'L'-suffixed integer literals.
(Rough first cut.)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/list_tests.py22
-rw-r--r--Lib/test/mapping_tests.py4
-rw-r--r--Lib/test/pickletester.py16
-rwxr-xr-xLib/test/regrtest.py2
-rw-r--r--Lib/test/seq_tests.py30
-rw-r--r--Lib/test/string_tests.py6
-rwxr-xr-xLib/test/test_array.py18
-rw-r--r--Lib/test/test_ast.py4
-rw-r--r--Lib/test/test_asynchat.py2
-rw-r--r--Lib/test/test_bigmem.py4
-rw-r--r--Lib/test/test_binop.py14
-rw-r--r--Lib/test/test_builtin.py460
-rw-r--r--Lib/test/test_bytes.py4
-rw-r--r--Lib/test/test_class.py27
-rw-r--r--Lib/test/test_code.py2
-rw-r--r--Lib/test/test_compare.py2
-rw-r--r--Lib/test/test_compile.py12
-rw-r--r--Lib/test/test_complex.py20
-rw-r--r--Lib/test/test_cookielib.py2
-rw-r--r--Lib/test/test_copy.py4
-rw-r--r--Lib/test/test_copy_reg.py2
-rw-r--r--Lib/test/test_datetime.py24
-rw-r--r--Lib/test/test_decimal.py4
-rw-r--r--Lib/test/test_descr.py105
-rw-r--r--Lib/test/test_dict.py4
-rw-r--r--Lib/test/test_format.py50
-rw-r--r--Lib/test/test_functools.py4
-rw-r--r--Lib/test/test_generators.py6
-rw-r--r--Lib/test/test_getargs2.py26
-rw-r--r--Lib/test/test_grammar.py18
-rw-r--r--Lib/test/test_hash.py6
-rw-r--r--Lib/test/test_hexoct.py48
-rw-r--r--Lib/test/test_index.py4
-rw-r--r--Lib/test/test_isinstance.py2
-rw-r--r--Lib/test/test_largefile.py4
-rw-r--r--Lib/test/test_long.py68
-rw-r--r--Lib/test/test_long_future.py18
-rw-r--r--Lib/test/test_marshal.py6
-rw-r--r--Lib/test/test_multibytecodec_support.py2
-rw-r--r--Lib/test/test_operator.py2
-rw-r--r--Lib/test/test_optparse.py10
-rw-r--r--Lib/test/test_poll.py2
-rw-r--r--Lib/test/test_pow.py24
-rw-r--r--Lib/test/test_pprint.py4
-rw-r--r--Lib/test/test_random.py36
-rw-r--r--Lib/test/test_repr.py4
-rw-r--r--Lib/test/test_resource.py2
-rw-r--r--Lib/test/test_slice.py4
-rw-r--r--Lib/test/test_socket.py8
-rwxr-xr-xLib/test/test_strftime.py2
-rw-r--r--Lib/test/test_string.py2
-rw-r--r--Lib/test/test_strop.py2
-rw-r--r--Lib/test/test_struct.py36
-rw-r--r--Lib/test/test_time.py4
-rw-r--r--Lib/test/test_timeout.py4
-rw-r--r--Lib/test/test_types.py60
-rw-r--r--Lib/test/test_unary.py12
-rw-r--r--Lib/test/test_unicode.py2
-rw-r--r--Lib/test/test_uuid.py98
-rw-r--r--Lib/test/test_xdrlib.py4
-rw-r--r--Lib/test/test_xmlrpc.py8
-rw-r--r--Lib/test/test_xrange.py2
-rw-r--r--Lib/test/test_zipimport.py2
-rw-r--r--Lib/test/test_zlib.py4
64 files changed, 683 insertions, 711 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index fc1a6c3..3867be5 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -99,16 +99,16 @@ class CommonTest(seq_tests.CommonTest):
self.assertRaises(TypeError, a.__setitem__)
a = self.type2test([0,1,2,3,4])
- a[0L] = 1
- a[1L] = 2
- a[2L] = 3
+ a[0] = 1
+ a[1] = 2
+ a[2] = 3
self.assertEqual(a, self.type2test([1,2,3,3,4]))
a[0] = 5
a[1] = 6
a[2] = 7
self.assertEqual(a, self.type2test([5,6,7,3,4]))
- a[-2L] = 88
- a[-1L] = 99
+ a[-2] = 88
+ a[-1] = 99
self.assertEqual(a, self.type2test([5,6,7,88,99]))
a[-2] = 8
a[-1] = 9
@@ -189,8 +189,8 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(a, self.type2test([]))
a = self.type2test([0, 1])
- del a[1L:2L]
- del a[0L:1L]
+ del a[1:2]
+ del a[0:1]
self.assertEqual(a, self.type2test([]))
a = self.type2test([0, 1])
@@ -198,7 +198,7 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(a, self.type2test([1]))
a = self.type2test([0, 1])
- del a[-2L:-1L]
+ del a[-2:-1]
self.assertEqual(a, self.type2test([1]))
a = self.type2test([0, 1])
@@ -207,8 +207,8 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(a, self.type2test([]))
a = self.type2test([0, 1])
- del a[1L:]
- del a[:1L]
+ del a[1:]
+ del a[:1]
self.assertEqual(a, self.type2test([]))
a = self.type2test([0, 1])
@@ -216,7 +216,7 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(a, self.type2test([0]))
a = self.type2test([0, 1])
- del a[-1L:]
+ del a[-1:]
self.assertEqual(a, self.type2test([0]))
a = self.type2test([0, 1])
diff --git a/Lib/test/mapping_tests.py b/Lib/test/mapping_tests.py
index 15f9add..6b872c4 100644
--- a/Lib/test/mapping_tests.py
+++ b/Lib/test/mapping_tests.py
@@ -526,7 +526,7 @@ class TestMappingProtocol(BasicTestMappingProtocol):
# verify longs/ints get same value when key > 32 bits (for 64-bit archs)
# see SF bug #689659
- x = 4503599627370496L
+ x = 4503599627370496
y = 4503599627370496
h = self._full_mapping({x: 'anything', y: 'something else'})
self.assertEqual(h[x], h[y])
@@ -626,7 +626,7 @@ class TestHashMappingProtocol(TestMappingProtocol):
def test_eq(self):
self.assertEqual(self._empty_mapping(), self._empty_mapping())
self.assertEqual(self._full_mapping({1: 2}),
- self._full_mapping({1L: 2L}))
+ self._full_mapping({1: 2}))
class Exc(Exception): pass
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 0f1386e..5d340b3 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -349,7 +349,7 @@ def create_data():
c = C()
c.foo = 1
c.bar = 2
- x = [0, 1L, 2.0, 3.0+0j]
+ x = [0, 1, 2.0, 3.0+0j]
# Append some integer test cases at cPickle.c's internal size
# cutoffs.
uint1max = 0xff
@@ -504,7 +504,7 @@ class AbstractPickleTests(unittest.TestCase):
n = n >> 1
def test_maxint64(self):
- maxint64 = (1L << 63) - 1
+ maxint64 = (1 << 63) - 1
data = 'I' + str(maxint64) + '\n.'
got = self.loads(data)
self.assertEqual(got, maxint64)
@@ -517,7 +517,7 @@ class AbstractPickleTests(unittest.TestCase):
for proto in protocols:
# 256 bytes is where LONG4 begins.
for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
- nbase = 1L << nbits
+ nbase = 1 << nbits
for npos in nbase-1, nbase, nbase+1:
for n in npos, -npos:
pickle = self.dumps(n, proto)
@@ -525,7 +525,7 @@ class AbstractPickleTests(unittest.TestCase):
self.assertEqual(n, got)
# Try a monster. This is quadratic-time in protos 0 & 1, so don't
# bother with those.
- nbase = long("deadbeeffeedface", 16)
+ nbase = int("deadbeeffeedface", 16)
nbase += nbase << 1000000
for n in nbase, -nbase:
p = self.dumps(n, 2)
@@ -592,7 +592,7 @@ class AbstractPickleTests(unittest.TestCase):
self.fail("expected bad protocol number to raise ValueError")
def test_long1(self):
- x = 12345678910111213141516178920L
+ x = 12345678910111213141516178920
for proto in protocols:
s = self.dumps(x, proto)
y = self.loads(s)
@@ -600,7 +600,7 @@ class AbstractPickleTests(unittest.TestCase):
self.assertEqual(opcode_in_pickle(pickle.LONG1, s), proto >= 2)
def test_long4(self):
- x = 12345678910111213141516178920L << (256*8)
+ x = 12345678910111213141516178920 << (256*8)
for proto in protocols:
s = self.dumps(x, proto)
y = self.loads(s)
@@ -864,8 +864,8 @@ class REX_three(object):
class MyInt(int):
sample = 1
-class MyLong(long):
- sample = 1L
+class MyLong(int):
+ sample = 1
class MyFloat(float):
sample = 1.0
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index ce39649..4517c59 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1324,7 +1324,7 @@ class _ExpectedSkips:
if test_timeout.skip_expected:
self.expected.add('test_timeout')
- if sys.maxint == 9223372036854775807L:
+ if sys.maxint == 9223372036854775807:
self.expected.add('test_rgbimg')
self.expected.add('test_imageop')
diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py
index 18fb3b7..0dfe7e4 100644
--- a/Lib/test/seq_tests.py
+++ b/Lib/test/seq_tests.py
@@ -138,10 +138,10 @@ class CommonTest(unittest.TestCase):
u = self.type2test([0, 1, 2, 3, 4])
for i in xrange(len(u)):
self.assertEqual(u[i], i)
- self.assertEqual(u[long(i)], i)
+ self.assertEqual(u[int(i)], i)
for i in xrange(-len(u), -1):
self.assertEqual(u[i], len(u)+i)
- self.assertEqual(u[long(i)], len(u)+i)
+ self.assertEqual(u[int(i)], len(u)+i)
self.assertRaises(IndexError, u.__getitem__, -len(u)-1)
self.assertRaises(IndexError, u.__getitem__, len(u))
self.assertRaises(ValueError, u.__getitem__, slice(0,10,0))
@@ -189,12 +189,12 @@ class CommonTest(unittest.TestCase):
self.assertEqual(u[-100:100:], u)
self.assertEqual(u[100:-100:-1], u[::-1])
self.assertEqual(u[-100:100:-1], self.type2test([]))
- self.assertEqual(u[-100L:100L:2L], self.type2test([0, 2, 4]))
+ self.assertEqual(u[-100:100:2], self.type2test([0, 2, 4]))
# Test extreme cases with long ints
a = self.type2test([0,1,2,3,4])
- self.assertEqual(a[ -pow(2,128L): 3 ], self.type2test([0,1,2]))
- self.assertEqual(a[ 3: pow(2,145L) ], self.type2test([3,4]))
+ self.assertEqual(a[ -pow(2,128): 3 ], self.type2test([0,1,2]))
+ self.assertEqual(a[ 3: pow(2,145) ], self.type2test([3,4]))
self.assertRaises(TypeError, u.__getslice__)
@@ -254,16 +254,16 @@ class CommonTest(unittest.TestCase):
self.assertEqual(self.type2test([-1]) + u1, self.type2test([-1, 0]))
self.assertEqual(self.type2test(), u2*0)
self.assertEqual(self.type2test(), 0*u2)
- self.assertEqual(self.type2test(), u2*0L)
- self.assertEqual(self.type2test(), 0L*u2)
+ self.assertEqual(self.type2test(), u2*0)
+ self.assertEqual(self.type2test(), 0*u2)
+ self.assertEqual(u2, u2*1)
+ self.assertEqual(u2, 1*u2)
self.assertEqual(u2, u2*1)
self.assertEqual(u2, 1*u2)
- self.assertEqual(u2, u2*1L)
- self.assertEqual(u2, 1L*u2)
self.assertEqual(u2+u2, u2*2)
self.assertEqual(u2+u2, 2*u2)
- self.assertEqual(u2+u2, u2*2L)
- self.assertEqual(u2+u2, 2L*u2)
+ self.assertEqual(u2+u2, u2*2)
+ self.assertEqual(u2+u2, 2*u2)
self.assertEqual(u2+u2+u2, u2*3)
self.assertEqual(u2+u2+u2, 3*u2)
@@ -308,10 +308,10 @@ class CommonTest(unittest.TestCase):
def test_subscript(self):
a = self.type2test([10, 11])
- self.assertEqual(a.__getitem__(0L), 10)
- self.assertEqual(a.__getitem__(1L), 11)
- self.assertEqual(a.__getitem__(-2L), 10)
- self.assertEqual(a.__getitem__(-1L), 11)
+ self.assertEqual(a.__getitem__(0), 10)
+ self.assertEqual(a.__getitem__(1), 11)
+ self.assertEqual(a.__getitem__(-2), 10)
+ self.assertEqual(a.__getitem__(-1), 11)
self.assertRaises(IndexError, a.__getitem__, -3)
self.assertRaises(IndexError, a.__getitem__, 3)
self.assertEqual(a.__getitem__(slice(0,1)), self.type2test([10]))
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 2116ea4..17e3389 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -12,7 +12,7 @@ class Sequence:
def __getitem__(self, i): return self.seq[i]
class BadSeq1(Sequence):
- def __init__(self): self.seq = [7, 'hello', 123L]
+ def __init__(self): self.seq = [7, 'hello', 123]
class BadSeq2(Sequence):
def __init__(self): self.seq = ['a', 'b', 'c']
@@ -902,7 +902,7 @@ class MixinStrUnicodeUserStringTest:
def test_subscript(self):
self.checkequal(u'a', 'abc', '__getitem__', 0)
self.checkequal(u'c', 'abc', '__getitem__', -1)
- self.checkequal(u'a', 'abc', '__getitem__', 0L)
+ self.checkequal(u'a', 'abc', '__getitem__', 0)
self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 3))
self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000))
self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1))
@@ -965,7 +965,7 @@ class MixinStrUnicodeUserStringTest:
self.checkraises(TypeError, ' ', 'join')
self.checkraises(TypeError, ' ', 'join', 7)
- self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123L]))
+ self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123]))
try:
def f():
yield 4 + ""
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 5c79b48..17d494c 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -61,7 +61,7 @@ class BaseTest(unittest.TestCase):
bi = a.buffer_info()
self.assert_(isinstance(bi, tuple))
self.assertEqual(len(bi), 2)
- self.assert_(isinstance(bi[0], (int, long)))
+ self.assert_(isinstance(bi[0], (int, int)))
self.assert_(isinstance(bi[1], int))
self.assertEqual(bi[1], len(a))
@@ -323,9 +323,9 @@ class BaseTest(unittest.TestCase):
def test_getitem(self):
a = array.array(self.typecode, self.example)
self.assertEntryEqual(a[0], self.example[0])
- self.assertEntryEqual(a[0L], self.example[0])
+ self.assertEntryEqual(a[0], self.example[0])
+ self.assertEntryEqual(a[-1], self.example[-1])
self.assertEntryEqual(a[-1], self.example[-1])
- self.assertEntryEqual(a[-1L], self.example[-1])
self.assertEntryEqual(a[len(self.example)-1], self.example[-1])
self.assertEntryEqual(a[-len(self.example)], self.example[0])
self.assertRaises(TypeError, a.__getitem__)
@@ -338,7 +338,7 @@ class BaseTest(unittest.TestCase):
self.assertEntryEqual(a[0], a[-1])
a = array.array(self.typecode, self.example)
- a[0L] = a[-1]
+ a[0] = a[-1]
self.assertEntryEqual(a[0], a[-1])
a = array.array(self.typecode, self.example)
@@ -346,7 +346,7 @@ class BaseTest(unittest.TestCase):
self.assertEntryEqual(a[0], a[-1])
a = array.array(self.typecode, self.example)
- a[-1L] = a[0]
+ a[-1] = a[0]
self.assertEntryEqual(a[0], a[-1])
a = array.array(self.typecode, self.example)
@@ -777,7 +777,7 @@ class NumberTest(BaseTest):
self.assertEqual(a[3::-2], array.array(self.typecode, [3,1]))
self.assertEqual(a[-100:100:], a)
self.assertEqual(a[100:-100:-1], a[::-1])
- self.assertEqual(a[-100L:100L:2L], array.array(self.typecode, [0,2,4]))
+ self.assertEqual(a[-100:100:2], array.array(self.typecode, [0,2,4]))
self.assertEqual(a[1000:2000:2], array.array(self.typecode, []))
self.assertEqual(a[-1000:-2000:-2], array.array(self.typecode, []))
@@ -863,8 +863,8 @@ class SignedNumberTest(NumberTest):
def test_overflow(self):
a = array.array(self.typecode)
- lower = -1 * long(pow(2, a.itemsize * 8 - 1))
- upper = long(pow(2, a.itemsize * 8 - 1)) - 1L
+ lower = -1 * int(pow(2, a.itemsize * 8 - 1))
+ upper = int(pow(2, a.itemsize * 8 - 1)) - 1
self.check_overflow(lower, upper)
class UnsignedNumberTest(NumberTest):
@@ -876,7 +876,7 @@ class UnsignedNumberTest(NumberTest):
def test_overflow(self):
a = array.array(self.typecode)
lower = 0
- upper = long(pow(2, a.itemsize * 8)) - 1L
+ upper = int(pow(2, a.itemsize * 8)) - 1
self.check_overflow(lower, upper)
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 914f1d9..289b533 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -2,7 +2,7 @@ import sys, itertools
import _ast
def to_tuple(t):
- if t is None or isinstance(t, (basestring, int, long, complex)):
+ if t is None or isinstance(t, (basestring, int, int, complex)):
return t
elif isinstance(t, list):
return [to_tuple(e) for e in t]
@@ -93,7 +93,7 @@ eval_tests = [
# Call
"f(1,2,c=3,*d,**e)",
# Num
- "10L",
+ "10",
# Str
"'string'",
# Attribute
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 9926167..6bcedd6 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -77,7 +77,7 @@ class TestAsynchat(unittest.TestCase):
s = echo_server()
s.start()
time.sleep(1) # Give server time to initialize
- c = echo_client(6L)
+ c = echo_client(6)
c.push("hello ")
c.push("world\n")
asyncore.loop()
diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 6d6c37c..5d2d844 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -866,13 +866,13 @@ class ListTest(unittest.TestCase):
@bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5)
def test_index(self, size):
- l = [1L, 2L, 3L, 4L, 5L] * size
+ l = [1, 2, 3, 4, 5] * size
size *= 5
self.assertEquals(l.index(1), 0)
self.assertEquals(l.index(5, size - 5), size - 1)
self.assertEquals(l.index(5, size - 5, size), size - 1)
self.assertRaises(ValueError, l.index, 1, size - 4, size)
- self.assertRaises(ValueError, l.index, 6L)
+ self.assertRaises(ValueError, l.index, 6)
# This tests suffers from overallocation, just like test_append.
@bigmemtest(minsize=_2G + 10, memuse=9)
diff --git a/Lib/test/test_binop.py b/Lib/test/test_binop.py
index ccce207..5aeb118 100644
--- a/Lib/test/test_binop.py
+++ b/Lib/test/test_binop.py
@@ -11,11 +11,11 @@ def gcd(a, b):
def isint(x):
"""Test whether an object is an instance of int or long."""
- return isinstance(x, int) or isinstance(x, long)
+ return isinstance(x, int) or isinstance(x, int)
def isnum(x):
"""Test whether an object is an instance of a built-in numeric type."""
- for T in int, long, float, complex:
+ for T in int, int, float, complex:
if isinstance(x, T):
return 1
return 0
@@ -30,7 +30,7 @@ class Rat(object):
__slots__ = ['_Rat__num', '_Rat__den']
- def __init__(self, num=0L, den=1L):
+ def __init__(self, num=0, den=1):
"""Constructor: Rat([num[, den]]).
The arguments must be ints or longs, and default to (0, 1)."""
@@ -42,8 +42,8 @@ class Rat(object):
if den == 0:
raise ZeroDivisionError, "zero denominator"
g = gcd(den, num)
- self.__num = long(num//g)
- self.__den = long(den//g)
+ self.__num = int(num//g)
+ self.__den = int(den//g)
def _get_num(self):
"""Accessor function for read-only 'num' attribute of Rat."""
@@ -80,7 +80,7 @@ class Rat(object):
def __long__(self):
"""Convert a Rat to an long; self.den must be 1."""
if self.__den == 1:
- return long(self.__num)
+ return int(self.__num)
raise ValueError, "can't convert %s to long" % repr(self)
def __add__(self, other):
@@ -225,7 +225,7 @@ class RatTestCase(unittest.TestCase):
a = Rat(10, 15)
self.assertEqual(a.num, 2)
self.assertEqual(a.den, 3)
- a = Rat(10L, 15L)
+ a = Rat(10, 15)
self.assertEqual(a.num, 2)
self.assertEqual(a.den, 3)
a = Rat(10, -15)
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index fb859d4..56417a3 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -122,9 +122,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(abs(3.14), 3.14)
self.assertEqual(abs(-3.14), 3.14)
# long
- self.assertEqual(abs(0L), 0L)
- self.assertEqual(abs(1234L), 1234L)
- self.assertEqual(abs(-1234L), 1234L)
+ self.assertEqual(abs(0), 0)
+ self.assertEqual(abs(1234), 1234)
+ self.assertEqual(abs(-1234), 1234)
# str
self.assertRaises(TypeError, abs, 'a')
@@ -235,15 +235,15 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(divmod(12, -7), (-2, -2))
self.assertEqual(divmod(-12, -7), (1, -5))
- self.assertEqual(divmod(12L, 7L), (1L, 5L))
- self.assertEqual(divmod(-12L, 7L), (-2L, 2L))
- self.assertEqual(divmod(12L, -7L), (-2L, -2L))
- self.assertEqual(divmod(-12L, -7L), (1L, -5L))
+ self.assertEqual(divmod(12, 7), (1, 5))
+ self.assertEqual(divmod(-12, 7), (-2, 2))
+ self.assertEqual(divmod(12, -7), (-2, -2))
+ self.assertEqual(divmod(-12, -7), (1, -5))
- self.assertEqual(divmod(12, 7L), (1, 5L))
- self.assertEqual(divmod(-12, 7L), (-2, 2L))
- self.assertEqual(divmod(12L, -7), (-2L, -2))
- self.assertEqual(divmod(-12L, -7), (1L, -5))
+ self.assertEqual(divmod(12, 7), (1, 5))
+ self.assertEqual(divmod(-12, 7), (-2, 2))
+ 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))
@@ -538,7 +538,7 @@ class BuiltinTest(unittest.TestCase):
def test_float(self):
self.assertEqual(float(3.14), 3.14)
self.assertEqual(float(314), 314.0)
- self.assertEqual(float(314L), 314.0)
+ self.assertEqual(float(314), 314.0)
self.assertEqual(float(" 3.14 "), 3.14)
self.assertRaises(ValueError, float, " 0x3.1 ")
self.assertRaises(ValueError, float, " -0x3.p-1 ")
@@ -624,7 +624,7 @@ class BuiltinTest(unittest.TestCase):
def test_hash(self):
hash(None)
- self.assertEqual(hash(1), hash(1L))
+ self.assertEqual(hash(1), hash(1))
self.assertEqual(hash(1), hash(1.0))
hash('spam')
if have_unicode:
@@ -642,22 +642,22 @@ class BuiltinTest(unittest.TestCase):
def __hash__(self):
return 2**100
self.assertEquals(type(hash(Y())), int)
- class Z(long):
+ class Z(int):
def __hash__(self):
return self
- self.assertEquals(hash(Z(42)), hash(42L))
+ self.assertEquals(hash(Z(42)), hash(42))
def test_hex(self):
self.assertEqual(hex(16), '0x10')
- self.assertEqual(hex(16L), '0x10')
+ self.assertEqual(hex(16), '0x10')
+ self.assertEqual(hex(-16), '-0x10')
self.assertEqual(hex(-16), '-0x10')
- self.assertEqual(hex(-16L), '-0x10')
self.assertRaises(TypeError, hex, {})
def test_id(self):
id(None)
id(1)
- id(1L)
+ id(1)
id(1.0)
id('spam')
id((0,1,2,3))
@@ -667,7 +667,7 @@ class BuiltinTest(unittest.TestCase):
def test_int(self):
self.assertEqual(int(314), 314)
self.assertEqual(int(3.14), 3)
- self.assertEqual(int(314L), 314)
+ self.assertEqual(int(314), 314)
# Check that conversion from float truncates towards zero
self.assertEqual(int(-3.14), -3)
self.assertEqual(int(3.9), 3)
@@ -675,9 +675,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(int(3.5), 3)
self.assertEqual(int(-3.5), -3)
# Different base:
- self.assertEqual(int("10",16), 16L)
+ self.assertEqual(int("10",16), 16)
if have_unicode:
- self.assertEqual(int(unicode("10"),16), 16L)
+ self.assertEqual(int(unicode("10"),16), 16)
# Test conversion from strings and various anomalies
for s, v in L:
for sign in "", "+", "-":
@@ -700,9 +700,9 @@ class BuiltinTest(unittest.TestCase):
# should return long
x = int(1e100)
- self.assert_(isinstance(x, long))
+ self.assert_(isinstance(x, int))
x = int(-1e100)
- self.assert_(isinstance(x, long))
+ self.assert_(isinstance(x, int))
# SF bug 434186: 0x80000000/2 != 0x80000000>>1.
@@ -720,11 +720,11 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(ValueError, int, '123\x00 245', 20)
x = int('1' * 600)
- self.assert_(isinstance(x, long))
+ self.assert_(isinstance(x, int))
if have_unicode:
x = int(unichr(0x661) * 600)
- self.assert_(isinstance(x, long))
+ self.assert_(isinstance(x, int))
self.assertRaises(TypeError, int, 1, 12)
@@ -735,79 +735,79 @@ class BuiltinTest(unittest.TestCase):
# Various representations of 2**32 evaluated to 0
# rather than 2**32 in previous versions
- self.assertEqual(int('100000000000000000000000000000000', 2), 4294967296L)
- self.assertEqual(int('102002022201221111211', 3), 4294967296L)
- self.assertEqual(int('10000000000000000', 4), 4294967296L)
- self.assertEqual(int('32244002423141', 5), 4294967296L)
- self.assertEqual(int('1550104015504', 6), 4294967296L)
- self.assertEqual(int('211301422354', 7), 4294967296L)
- self.assertEqual(int('40000000000', 8), 4294967296L)
- self.assertEqual(int('12068657454', 9), 4294967296L)
- self.assertEqual(int('4294967296', 10), 4294967296L)
- self.assertEqual(int('1904440554', 11), 4294967296L)
- self.assertEqual(int('9ba461594', 12), 4294967296L)
- self.assertEqual(int('535a79889', 13), 4294967296L)
- self.assertEqual(int('2ca5b7464', 14), 4294967296L)
- self.assertEqual(int('1a20dcd81', 15), 4294967296L)
- self.assertEqual(int('100000000', 16), 4294967296L)
- self.assertEqual(int('a7ffda91', 17), 4294967296L)
- self.assertEqual(int('704he7g4', 18), 4294967296L)
- self.assertEqual(int('4f5aff66', 19), 4294967296L)
- self.assertEqual(int('3723ai4g', 20), 4294967296L)
- self.assertEqual(int('281d55i4', 21), 4294967296L)
- self.assertEqual(int('1fj8b184', 22), 4294967296L)
- self.assertEqual(int('1606k7ic', 23), 4294967296L)
- self.assertEqual(int('mb994ag', 24), 4294967296L)
- self.assertEqual(int('hek2mgl', 25), 4294967296L)
- self.assertEqual(int('dnchbnm', 26), 4294967296L)
- self.assertEqual(int('b28jpdm', 27), 4294967296L)
- self.assertEqual(int('8pfgih4', 28), 4294967296L)
- self.assertEqual(int('76beigg', 29), 4294967296L)
- self.assertEqual(int('5qmcpqg', 30), 4294967296L)
- self.assertEqual(int('4q0jto4', 31), 4294967296L)
- self.assertEqual(int('4000000', 32), 4294967296L)
- self.assertEqual(int('3aokq94', 33), 4294967296L)
- self.assertEqual(int('2qhxjli', 34), 4294967296L)
- self.assertEqual(int('2br45qb', 35), 4294967296L)
- self.assertEqual(int('1z141z4', 36), 4294967296L)
+ self.assertEqual(int('100000000000000000000000000000000', 2), 4294967296)
+ self.assertEqual(int('102002022201221111211', 3), 4294967296)
+ self.assertEqual(int('10000000000000000', 4), 4294967296)
+ self.assertEqual(int('32244002423141', 5), 4294967296)
+ self.assertEqual(int('1550104015504', 6), 4294967296)
+ self.assertEqual(int('211301422354', 7), 4294967296)
+ self.assertEqual(int('40000000000', 8), 4294967296)
+ self.assertEqual(int('12068657454', 9), 4294967296)
+ self.assertEqual(int('4294967296', 10), 4294967296)
+ self.assertEqual(int('1904440554', 11), 4294967296)
+ self.assertEqual(int('9ba461594', 12), 4294967296)
+ self.assertEqual(int('535a79889', 13), 4294967296)
+ self.assertEqual(int('2ca5b7464', 14), 4294967296)
+ self.assertEqual(int('1a20dcd81', 15), 4294967296)
+ self.assertEqual(int('100000000', 16), 4294967296)
+ self.assertEqual(int('a7ffda91', 17), 4294967296)
+ self.assertEqual(int('704he7g4', 18), 4294967296)
+ self.assertEqual(int('4f5aff66', 19), 4294967296)
+ self.assertEqual(int('3723ai4g', 20), 4294967296)
+ self.assertEqual(int('281d55i4', 21), 4294967296)
+ self.assertEqual(int('1fj8b184', 22), 4294967296)
+ self.assertEqual(int('1606k7ic', 23), 4294967296)
+ self.assertEqual(int('mb994ag', 24), 4294967296)
+ self.assertEqual(int('hek2mgl', 25), 4294967296)
+ self.assertEqual(int('dnchbnm', 26), 4294967296)
+ self.assertEqual(int('b28jpdm', 27), 4294967296)
+ self.assertEqual(int('8pfgih4', 28), 4294967296)
+ self.assertEqual(int('76beigg', 29), 4294967296)
+ self.assertEqual(int('5qmcpqg', 30), 4294967296)
+ self.assertEqual(int('4q0jto4', 31), 4294967296)
+ self.assertEqual(int('4000000', 32), 4294967296)
+ self.assertEqual(int('3aokq94', 33), 4294967296)
+ self.assertEqual(int('2qhxjli', 34), 4294967296)
+ self.assertEqual(int('2br45qb', 35), 4294967296)
+ self.assertEqual(int('1z141z4', 36), 4294967296)
# SF bug 1334662: int(string, base) wrong answers
# Checks for proper evaluation of 2**32 + 1
- self.assertEqual(int('100000000000000000000000000000001', 2), 4294967297L)
- self.assertEqual(int('102002022201221111212', 3), 4294967297L)
- self.assertEqual(int('10000000000000001', 4), 4294967297L)
- self.assertEqual(int('32244002423142', 5), 4294967297L)
- self.assertEqual(int('1550104015505', 6), 4294967297L)
- self.assertEqual(int('211301422355', 7), 4294967297L)
- self.assertEqual(int('40000000001', 8), 4294967297L)
- self.assertEqual(int('12068657455', 9), 4294967297L)
- self.assertEqual(int('4294967297', 10), 4294967297L)
- self.assertEqual(int('1904440555', 11), 4294967297L)
- self.assertEqual(int('9ba461595', 12), 4294967297L)
- self.assertEqual(int('535a7988a', 13), 4294967297L)
- self.assertEqual(int('2ca5b7465', 14), 4294967297L)
- self.assertEqual(int('1a20dcd82', 15), 4294967297L)
- self.assertEqual(int('100000001', 16), 4294967297L)
- self.assertEqual(int('a7ffda92', 17), 4294967297L)
- self.assertEqual(int('704he7g5', 18), 4294967297L)
- self.assertEqual(int('4f5aff67', 19), 4294967297L)
- self.assertEqual(int('3723ai4h', 20), 4294967297L)
- self.assertEqual(int('281d55i5', 21), 4294967297L)
- self.assertEqual(int('1fj8b185', 22), 4294967297L)
- self.assertEqual(int('1606k7id', 23), 4294967297L)
- self.assertEqual(int('mb994ah', 24), 4294967297L)
- self.assertEqual(int('hek2mgm', 25), 4294967297L)
- self.assertEqual(int('dnchbnn', 26), 4294967297L)
- self.assertEqual(int('b28jpdn', 27), 4294967297L)
- self.assertEqual(int('8pfgih5', 28), 4294967297L)
- self.assertEqual(int('76beigh', 29), 4294967297L)
- self.assertEqual(int('5qmcpqh', 30), 4294967297L)
- self.assertEqual(int('4q0jto5', 31), 4294967297L)
- self.assertEqual(int('4000001', 32), 4294967297L)
- self.assertEqual(int('3aokq95', 33), 4294967297L)
- self.assertEqual(int('2qhxjlj', 34), 4294967297L)
- self.assertEqual(int('2br45qc', 35), 4294967297L)
- self.assertEqual(int('1z141z5', 36), 4294967297L)
+ self.assertEqual(int('100000000000000000000000000000001', 2), 4294967297)
+ self.assertEqual(int('102002022201221111212', 3), 4294967297)
+ self.assertEqual(int('10000000000000001', 4), 4294967297)
+ self.assertEqual(int('32244002423142', 5), 4294967297)
+ self.assertEqual(int('1550104015505', 6), 4294967297)
+ self.assertEqual(int('211301422355', 7), 4294967297)
+ self.assertEqual(int('40000000001', 8), 4294967297)
+ self.assertEqual(int('12068657455', 9), 4294967297)
+ self.assertEqual(int('4294967297', 10), 4294967297)
+ self.assertEqual(int('1904440555', 11), 4294967297)
+ self.assertEqual(int('9ba461595', 12), 4294967297)
+ self.assertEqual(int('535a7988a', 13), 4294967297)
+ self.assertEqual(int('2ca5b7465', 14), 4294967297)
+ self.assertEqual(int('1a20dcd82', 15), 4294967297)
+ self.assertEqual(int('100000001', 16), 4294967297)
+ self.assertEqual(int('a7ffda92', 17), 4294967297)
+ self.assertEqual(int('704he7g5', 18), 4294967297)
+ self.assertEqual(int('4f5aff67', 19), 4294967297)
+ self.assertEqual(int('3723ai4h', 20), 4294967297)
+ self.assertEqual(int('281d55i5', 21), 4294967297)
+ self.assertEqual(int('1fj8b185', 22), 4294967297)
+ self.assertEqual(int('1606k7id', 23), 4294967297)
+ self.assertEqual(int('mb994ah', 24), 4294967297)
+ self.assertEqual(int('hek2mgm', 25), 4294967297)
+ self.assertEqual(int('dnchbnn', 26), 4294967297)
+ self.assertEqual(int('b28jpdn', 27), 4294967297)
+ self.assertEqual(int('8pfgih5', 28), 4294967297)
+ self.assertEqual(int('76beigh', 29), 4294967297)
+ self.assertEqual(int('5qmcpqh', 30), 4294967297)
+ self.assertEqual(int('4q0jto5', 31), 4294967297)
+ self.assertEqual(int('4000001', 32), 4294967297)
+ self.assertEqual(int('3aokq95', 33), 4294967297)
+ self.assertEqual(int('2qhxjlj', 34), 4294967297)
+ self.assertEqual(int('2br45qc', 35), 4294967297)
+ self.assertEqual(int('1z141z5', 36), 4294967297)
def test_intconversion(self):
# Test __int__()
@@ -829,7 +829,7 @@ class BuiltinTest(unittest.TestCase):
class Foo4(int):
def __int__(self):
- return 42L
+ return 42
class Foo5(int):
def __int__(self):
@@ -839,7 +839,7 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(int(Foo1()), 42)
self.assertEqual(int(Foo2()), 42)
self.assertEqual(int(Foo3()), 0)
- self.assertEqual(int(Foo4()), 42L)
+ self.assertEqual(int(Foo4()), 42)
self.assertRaises(TypeError, int, Foo5())
def test_iter(self):
@@ -935,32 +935,32 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(x, [])
def test_long(self):
- self.assertEqual(long(314), 314L)
- self.assertEqual(long(3.14), 3L)
- self.assertEqual(long(314L), 314L)
+ self.assertEqual(int(314), 314)
+ self.assertEqual(int(3.14), 3)
+ self.assertEqual(int(314), 314)
# Check that conversion from float truncates towards zero
- self.assertEqual(long(-3.14), -3L)
- self.assertEqual(long(3.9), 3L)
- self.assertEqual(long(-3.9), -3L)
- self.assertEqual(long(3.5), 3L)
- self.assertEqual(long(-3.5), -3L)
- self.assertEqual(long("-3"), -3L)
+ self.assertEqual(int(-3.14), -3)
+ self.assertEqual(int(3.9), 3)
+ self.assertEqual(int(-3.9), -3)
+ self.assertEqual(int(3.5), 3)
+ self.assertEqual(int(-3.5), -3)
+ self.assertEqual(int("-3"), -3)
if have_unicode:
- self.assertEqual(long(unicode("-3")), -3L)
+ self.assertEqual(int(unicode("-3")), -3)
# Different base:
- self.assertEqual(long("10",16), 16L)
+ self.assertEqual(int("10",16), 16)
if have_unicode:
- self.assertEqual(long(unicode("10"),16), 16L)
+ self.assertEqual(int(unicode("10"),16), 16)
# Check conversions from string (same test set as for int(), and then some)
LL = [
- ('1' + '0'*20, 10L**20),
- ('1' + '0'*100, 10L**100)
+ ('1' + '0'*20, 10**20),
+ ('1' + '0'*100, 10**100)
]
L2 = L[:]
if have_unicode:
L2 += [
- (unicode('1') + unicode('0')*20, 10L**20),
- (unicode('1') + unicode('0')*100, 10L**100),
+ (unicode('1') + unicode('0')*20, 10**20),
+ (unicode('1') + unicode('0')*100, 10**100),
]
for s, v in L2 + LL:
for sign in "", "+", "-":
@@ -970,120 +970,120 @@ class BuiltinTest(unittest.TestCase):
if sign == "-" and v is not ValueError:
vv = -v
try:
- self.assertEqual(long(ss), long(vv))
+ self.assertEqual(int(ss), int(vv))
except v:
pass
- self.assertRaises(ValueError, long, '123\0')
- self.assertRaises(ValueError, long, '53', 40)
- self.assertRaises(TypeError, long, 1, 12)
+ self.assertRaises(ValueError, int, '123\0')
+ self.assertRaises(ValueError, int, '53', 40)
+ self.assertRaises(TypeError, int, 1, 12)
- self.assertEqual(long('100000000000000000000000000000000', 2),
+ self.assertEqual(int('100000000000000000000000000000000', 2),
4294967296)
- self.assertEqual(long('102002022201221111211', 3), 4294967296)
- self.assertEqual(long('10000000000000000', 4), 4294967296)
- self.assertEqual(long('32244002423141', 5), 4294967296)
- self.assertEqual(long('1550104015504', 6), 4294967296)
- self.assertEqual(long('211301422354', 7), 4294967296)
- self.assertEqual(long('40000000000', 8), 4294967296)
- self.assertEqual(long('12068657454', 9), 4294967296)
- self.assertEqual(long('4294967296', 10), 4294967296)
- self.assertEqual(long('1904440554', 11), 4294967296)
- self.assertEqual(long('9ba461594', 12), 4294967296)
- self.assertEqual(long('535a79889', 13), 4294967296)
- self.assertEqual(long('2ca5b7464', 14), 4294967296)
- self.assertEqual(long('1a20dcd81', 15), 4294967296)
- self.assertEqual(long('100000000', 16), 4294967296)
- self.assertEqual(long('a7ffda91', 17), 4294967296)
- self.assertEqual(long('704he7g4', 18), 4294967296)
- self.assertEqual(long('4f5aff66', 19), 4294967296)
- self.assertEqual(long('3723ai4g', 20), 4294967296)
- self.assertEqual(long('281d55i4', 21), 4294967296)
- self.assertEqual(long('1fj8b184', 22), 4294967296)
- self.assertEqual(long('1606k7ic', 23), 4294967296)
- self.assertEqual(long('mb994ag', 24), 4294967296)
- self.assertEqual(long('hek2mgl', 25), 4294967296)
- self.assertEqual(long('dnchbnm', 26), 4294967296)
- self.assertEqual(long('b28jpdm', 27), 4294967296)
- self.assertEqual(long('8pfgih4', 28), 4294967296)
- self.assertEqual(long('76beigg', 29), 4294967296)
- self.assertEqual(long('5qmcpqg', 30), 4294967296)
- self.assertEqual(long('4q0jto4', 31), 4294967296)
- self.assertEqual(long('4000000', 32), 4294967296)
- self.assertEqual(long('3aokq94', 33), 4294967296)
- self.assertEqual(long('2qhxjli', 34), 4294967296)
- self.assertEqual(long('2br45qb', 35), 4294967296)
- self.assertEqual(long('1z141z4', 36), 4294967296)
-
- self.assertEqual(long('100000000000000000000000000000001', 2),
+ self.assertEqual(int('102002022201221111211', 3), 4294967296)
+ self.assertEqual(int('10000000000000000', 4), 4294967296)
+ self.assertEqual(int('32244002423141', 5), 4294967296)
+ self.assertEqual(int('1550104015504', 6), 4294967296)
+ self.assertEqual(int('211301422354', 7), 4294967296)
+ self.assertEqual(int('40000000000', 8), 4294967296)
+ self.assertEqual(int('12068657454', 9), 4294967296)
+ self.assertEqual(int('4294967296', 10), 4294967296)
+ self.assertEqual(int('1904440554', 11), 4294967296)
+ self.assertEqual(int('9ba461594', 12), 4294967296)
+ self.assertEqual(int('535a79889', 13), 4294967296)
+ self.assertEqual(int('2ca5b7464', 14), 4294967296)
+ self.assertEqual(int('1a20dcd81', 15), 4294967296)
+ self.assertEqual(int('100000000', 16), 4294967296)
+ self.assertEqual(int('a7ffda91', 17), 4294967296)
+ self.assertEqual(int('704he7g4', 18), 4294967296)
+ self.assertEqual(int('4f5aff66', 19), 4294967296)
+ self.assertEqual(int('3723ai4g', 20), 4294967296)
+ self.assertEqual(int('281d55i4', 21), 4294967296)
+ self.assertEqual(int('1fj8b184', 22), 4294967296)
+ self.assertEqual(int('1606k7ic', 23), 4294967296)
+ self.assertEqual(int('mb994ag', 24), 4294967296)
+ self.assertEqual(int('hek2mgl', 25), 4294967296)
+ self.assertEqual(int('dnchbnm', 26), 4294967296)
+ self.assertEqual(int('b28jpdm', 27), 4294967296)
+ self.assertEqual(int('8pfgih4', 28), 4294967296)
+ self.assertEqual(int('76beigg', 29), 4294967296)
+ self.assertEqual(int('5qmcpqg', 30), 4294967296)
+ self.assertEqual(int('4q0jto4', 31), 4294967296)
+ self.assertEqual(int('4000000', 32), 4294967296)
+ self.assertEqual(int('3aokq94', 33), 4294967296)
+ self.assertEqual(int('2qhxjli', 34), 4294967296)
+ self.assertEqual(int('2br45qb', 35), 4294967296)
+ self.assertEqual(int('1z141z4', 36), 4294967296)
+
+ self.assertEqual(int('100000000000000000000000000000001', 2),
4294967297)
- self.assertEqual(long('102002022201221111212', 3), 4294967297)
- self.assertEqual(long('10000000000000001', 4), 4294967297)
- self.assertEqual(long('32244002423142', 5), 4294967297)
- self.assertEqual(long('1550104015505', 6), 4294967297)
- self.assertEqual(long('211301422355', 7), 4294967297)
- self.assertEqual(long('40000000001', 8), 4294967297)
- self.assertEqual(long('12068657455', 9), 4294967297)
- self.assertEqual(long('4294967297', 10), 4294967297)
- self.assertEqual(long('1904440555', 11), 4294967297)
- self.assertEqual(long('9ba461595', 12), 4294967297)
- self.assertEqual(long('535a7988a', 13), 4294967297)
- self.assertEqual(long('2ca5b7465', 14), 4294967297)
- self.assertEqual(long('1a20dcd82', 15), 4294967297)
- self.assertEqual(long('100000001', 16), 4294967297)
- self.assertEqual(long('a7ffda92', 17), 4294967297)
- self.assertEqual(long('704he7g5', 18), 4294967297)
- self.assertEqual(long('4f5aff67', 19), 4294967297)
- self.assertEqual(long('3723ai4h', 20), 4294967297)
- self.assertEqual(long('281d55i5', 21), 4294967297)
- self.assertEqual(long('1fj8b185', 22), 4294967297)
- self.assertEqual(long('1606k7id', 23), 4294967297)
- self.assertEqual(long('mb994ah', 24), 4294967297)
- self.assertEqual(long('hek2mgm', 25), 4294967297)
- self.assertEqual(long('dnchbnn', 26), 4294967297)
- self.assertEqual(long('b28jpdn', 27), 4294967297)
- self.assertEqual(long('8pfgih5', 28), 4294967297)
- self.assertEqual(long('76beigh', 29), 4294967297)
- self.assertEqual(long('5qmcpqh', 30), 4294967297)
- self.assertEqual(long('4q0jto5', 31), 4294967297)
- self.assertEqual(long('4000001', 32), 4294967297)
- self.assertEqual(long('3aokq95', 33), 4294967297)
- self.assertEqual(long('2qhxjlj', 34), 4294967297)
- self.assertEqual(long('2br45qc', 35), 4294967297)
- self.assertEqual(long('1z141z5', 36), 4294967297)
+ self.assertEqual(int('102002022201221111212', 3), 4294967297)
+ self.assertEqual(int('10000000000000001', 4), 4294967297)
+ self.assertEqual(int('32244002423142', 5), 4294967297)
+ self.assertEqual(int('1550104015505', 6), 4294967297)
+ self.assertEqual(int('211301422355', 7), 4294967297)
+ self.assertEqual(int('40000000001', 8), 4294967297)
+ self.assertEqual(int('12068657455', 9), 4294967297)
+ self.assertEqual(int('4294967297', 10), 4294967297)
+ self.assertEqual(int('1904440555', 11), 4294967297)
+ self.assertEqual(int('9ba461595', 12), 4294967297)
+ self.assertEqual(int('535a7988a', 13), 4294967297)
+ self.assertEqual(int('2ca5b7465', 14), 4294967297)
+ self.assertEqual(int('1a20dcd82', 15), 4294967297)
+ self.assertEqual(int('100000001', 16), 4294967297)
+ self.assertEqual(int('a7ffda92', 17), 4294967297)
+ self.assertEqual(int('704he7g5', 18), 4294967297)
+ self.assertEqual(int('4f5aff67', 19), 4294967297)
+ self.assertEqual(int('3723ai4h', 20), 4294967297)
+ self.assertEqual(int('281d55i5', 21), 4294967297)
+ self.assertEqual(int('1fj8b185', 22), 4294967297)
+ self.assertEqual(int('1606k7id', 23), 4294967297)
+ self.assertEqual(int('mb994ah', 24), 4294967297)
+ self.assertEqual(int('hek2mgm', 25), 4294967297)
+ self.assertEqual(int('dnchbnn', 26), 4294967297)
+ self.assertEqual(int('b28jpdn', 27), 4294967297)
+ self.assertEqual(int('8pfgih5', 28), 4294967297)
+ self.assertEqual(int('76beigh', 29), 4294967297)
+ self.assertEqual(int('5qmcpqh', 30), 4294967297)
+ self.assertEqual(int('4q0jto5', 31), 4294967297)
+ self.assertEqual(int('4000001', 32), 4294967297)
+ self.assertEqual(int('3aokq95', 33), 4294967297)
+ self.assertEqual(int('2qhxjlj', 34), 4294967297)
+ self.assertEqual(int('2br45qc', 35), 4294967297)
+ self.assertEqual(int('1z141z5', 36), 4294967297)
def test_longconversion(self):
# Test __long__()
class Foo0:
def __long__(self):
- return 42L
+ return 42
class Foo1(object):
def __long__(self):
- return 42L
+ return 42
- class Foo2(long):
+ class Foo2(int):
def __long__(self):
- return 42L
+ return 42
- class Foo3(long):
+ class Foo3(int):
def __long__(self):
return self
- class Foo4(long):
+ class Foo4(int):
def __long__(self):
return 42
- class Foo5(long):
+ class Foo5(int):
def __long__(self):
return 42.
- self.assertEqual(long(Foo0()), 42L)
- self.assertEqual(long(Foo1()), 42L)
+ self.assertEqual(int(Foo0()), 42)
+ self.assertEqual(int(Foo1()), 42)
# XXX invokes __int__ now
# self.assertEqual(long(Foo2()), 42L)
- self.assertEqual(long(Foo3()), 0)
+ self.assertEqual(int(Foo3()), 0)
# XXX likewise
# self.assertEqual(long(Foo4()), 42)
# self.assertRaises(TypeError, long, Foo5())
@@ -1174,9 +1174,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(max((1, 2, 3, 1, 2, 3)), 3)
self.assertEqual(max([1, 2, 3, 1, 2, 3]), 3)
- self.assertEqual(max(1, 2L, 3.0), 3.0)
- self.assertEqual(max(1L, 2.0, 3), 3)
- self.assertEqual(max(1.0, 2, 3L), 3L)
+ self.assertEqual(max(1, 2, 3.0), 3.0)
+ self.assertEqual(max(1, 2.0, 3), 3)
+ self.assertEqual(max(1.0, 2, 3), 3)
for stmt in (
"max(key=int)", # no args
@@ -1208,9 +1208,9 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(min((1, 2, 3, 1, 2, 3)), 1)
self.assertEqual(min([1, 2, 3, 1, 2, 3]), 1)
- self.assertEqual(min(1, 2L, 3.0), 1)
- self.assertEqual(min(1L, 2.0, 3), 1L)
- self.assertEqual(min(1.0, 2, 3L), 1.0)
+ self.assertEqual(min(1, 2, 3.0), 1)
+ self.assertEqual(min(1, 2.0, 3), 1)
+ self.assertEqual(min(1.0, 2, 3), 1.0)
self.assertRaises(TypeError, min)
self.assertRaises(TypeError, min, 42)
@@ -1250,9 +1250,9 @@ class BuiltinTest(unittest.TestCase):
def test_oct(self):
self.assertEqual(oct(100), '0144')
- self.assertEqual(oct(100L), '0144')
+ self.assertEqual(oct(100), '0144')
+ self.assertEqual(oct(-100), '-0144')
self.assertEqual(oct(-100), '-0144')
- self.assertEqual(oct(-100L), '-0144')
self.assertRaises(TypeError, oct, ())
def write_testfile(self):
@@ -1309,20 +1309,20 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(pow(-2,2), 4)
self.assertEqual(pow(-2,3), -8)
- self.assertEqual(pow(0L,0), 1)
- self.assertEqual(pow(0L,1), 0)
- self.assertEqual(pow(1L,0), 1)
- self.assertEqual(pow(1L,1), 1)
+ self.assertEqual(pow(0,0), 1)
+ self.assertEqual(pow(0,1), 0)
+ self.assertEqual(pow(1,0), 1)
+ self.assertEqual(pow(1,1), 1)
- self.assertEqual(pow(2L,0), 1)
- self.assertEqual(pow(2L,10), 1024)
- self.assertEqual(pow(2L,20), 1024*1024)
- self.assertEqual(pow(2L,30), 1024*1024*1024)
+ self.assertEqual(pow(2,0), 1)
+ self.assertEqual(pow(2,10), 1024)
+ self.assertEqual(pow(2,20), 1024*1024)
+ self.assertEqual(pow(2,30), 1024*1024*1024)
- self.assertEqual(pow(-2L,0), 1)
- self.assertEqual(pow(-2L,1), -2)
- self.assertEqual(pow(-2L,2), 4)
- self.assertEqual(pow(-2L,3), -8)
+ self.assertEqual(pow(-2,0), 1)
+ self.assertEqual(pow(-2,1), -2)
+ self.assertEqual(pow(-2,2), 4)
+ self.assertEqual(pow(-2,3), -8)
self.assertAlmostEqual(pow(0.,0), 1.)
self.assertAlmostEqual(pow(0.,1), 0.)
@@ -1339,9 +1339,9 @@ class BuiltinTest(unittest.TestCase):
self.assertAlmostEqual(pow(-2.,2), 4.)
self.assertAlmostEqual(pow(-2.,3), -8.)
- for x in 2, 2L, 2.0:
- for y in 10, 10L, 10.0:
- for z in 1000, 1000L, 1000.0:
+ for x in 2, 2, 2.0:
+ for y in 10, 10, 10.0:
+ for z in 1000, 1000, 1000.0:
if isinstance(x, float) or \
isinstance(y, float) or \
isinstance(z, float):
@@ -1351,8 +1351,8 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(TypeError, pow, -1, -2, 3)
self.assertRaises(ValueError, pow, 1, 2, 0)
- self.assertRaises(TypeError, pow, -1L, -2L, 3L)
- self.assertRaises(ValueError, pow, 1L, 2L, 0L)
+ self.assertRaises(TypeError, pow, -1, -2, 3)
+ self.assertRaises(ValueError, pow, 1, 2, 0)
self.assertRaises(ValueError, pow, -342.43, 0.234)
self.assertRaises(TypeError, pow)
@@ -1371,12 +1371,12 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(range(0, 2**100, -1), [])
self.assertEqual(range(0, 2**100, -1), [])
- a = long(10 * sys.maxint)
- b = long(100 * sys.maxint)
- c = long(50 * sys.maxint)
+ a = int(10 * sys.maxint)
+ b = int(100 * sys.maxint)
+ c = int(50 * sys.maxint)
self.assertEqual(range(a, a+2), [a, a+1])
- self.assertEqual(range(a+2, a, -1L), [a+2, a+1])
+ self.assertEqual(range(a+2, a, -1), [a+2, a+1])
self.assertEqual(range(a+4, a, -2), [a+4, a+2])
seq = range(a, b, c)
@@ -1397,7 +1397,7 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(TypeError, range)
self.assertRaises(TypeError, range, 1, 2, 3, 4)
self.assertRaises(ValueError, range, 1, 2, 0)
- self.assertRaises(ValueError, range, a, a + 1, long(0))
+ self.assertRaises(ValueError, range, a, a + 1, int(0))
class badzero(int):
def __eq__(self, other):
@@ -1428,7 +1428,7 @@ class BuiltinTest(unittest.TestCase):
def test_repr(self):
self.assertEqual(repr(''), '\'\'')
self.assertEqual(repr(0), '0')
- self.assertEqual(repr(0L), '0')
+ self.assertEqual(repr(0), '0')
self.assertEqual(repr(()), '()')
self.assertEqual(repr([]), '[]')
self.assertEqual(repr({}), '{}')
@@ -1484,7 +1484,7 @@ class BuiltinTest(unittest.TestCase):
def test_str(self):
self.assertEqual(str(''), '')
self.assertEqual(str(0), '0')
- self.assertEqual(str(0L), '0')
+ self.assertEqual(str(0), '0')
self.assertEqual(str(()), '()')
self.assertEqual(str([]), '[]')
self.assertEqual(str({}), '{}')
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index be95935..997122b 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -361,9 +361,9 @@ class BytesTest(unittest.TestCase):
def test_contains(self):
b = bytes("abc")
self.failUnless(ord('a') in b)
- self.failUnless(long(ord('a')) in b)
+ self.failUnless(int(ord('a')) in b)
+ self.failIf(200 in b)
self.failIf(200 in b)
- self.failIf(200L in b)
self.assertRaises(ValueError, lambda: 300 in b)
self.assertRaises(ValueError, lambda: -1 in b)
self.assertRaises(TypeError, lambda: None in b)
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 1758fd4..c450c80 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -84,10 +84,6 @@ class AllTests:
print "__float__:", args
return 1.0
- def __long__(self, *args):
- print "__long__:", args
- return 1L
-
def __oct__(self, *args):
print "__oct__:", args
return '01'
@@ -238,7 +234,7 @@ else:
+testme
abs(testme)
int(testme)
-long(testme)
+int(testme)
float(testme)
oct(testme)
hex(testme)
@@ -289,7 +285,6 @@ class BadTypeClass:
def __int__(self):
return None
__float__ = __int__
- __long__ = __int__
__str__ = __int__
__repr__ = __int__
__oct__ = __int__
@@ -307,31 +302,11 @@ def check_exc(stmt, exception):
check_exc("int(BadTypeClass())", TypeError)
check_exc("float(BadTypeClass())", TypeError)
-check_exc("long(BadTypeClass())", TypeError)
check_exc("str(BadTypeClass())", TypeError)
check_exc("repr(BadTypeClass())", TypeError)
check_exc("oct(BadTypeClass())", TypeError)
check_exc("hex(BadTypeClass())", TypeError)
-# mixing up ints and longs is okay
-class IntLongMixClass:
- def __int__(self):
- return 0L
-
- def __long__(self):
- return 0
-
-try:
- int(IntLongMixClass())
-except TypeError:
- raise TestFailed, "TypeError should not be raised"
-
-try:
- long(IntLongMixClass())
-except TypeError:
- raise TestFailed, "TypeError should not be raised"
-
-
# Test correct errors from hash() on objects with comparisons but no __hash__
class C0:
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 7ee7dcd..6e0a181 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -70,7 +70,7 @@ consts: ('None',)
... 'doc string'
... 'not a docstring'
... 53
-... 53L
+... 0x53
>>> dump(optimize_away.func_code)
name: optimize_away
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 8f38e3b..1d0da69 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -17,7 +17,7 @@ class Cmp:
return self.arg == other
class ComparisonTest(unittest.TestCase):
- set1 = [2, 2.0, 2L, 2+0j, Cmp(2.0)]
+ set1 = [2, 2.0, 2, 2+0j, Cmp(2.0)]
set2 = [[1], (3,), None, Empty()]
candidates = set1 + set2
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index b517daa..1acb4a1 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -182,10 +182,8 @@ if 1:
self.assertRaises(SyntaxError, eval, arg)
self.assertEqual(eval("0777"), 511)
- self.assertEqual(eval("0777L"), 511)
self.assertEqual(eval("000777"), 511)
self.assertEqual(eval("0xff"), 255)
- self.assertEqual(eval("0xffL"), 255)
self.assertEqual(eval("0XfF"), 255)
self.assertEqual(eval("0777."), 777)
self.assertEqual(eval("0777.0"), 777)
@@ -212,19 +210,19 @@ if 1:
if sys.maxint == 2147483647:
# 32-bit machine
all_one_bits = '0xffffffff'
- self.assertEqual(eval(all_one_bits), 4294967295L)
- self.assertEqual(eval("-" + all_one_bits), -4294967295L)
+ self.assertEqual(eval(all_one_bits), 4294967295)
+ self.assertEqual(eval("-" + all_one_bits), -4294967295)
elif sys.maxint == 9223372036854775807:
# 64-bit machine
all_one_bits = '0xffffffffffffffff'
- self.assertEqual(eval(all_one_bits), 18446744073709551615L)
- self.assertEqual(eval("-" + all_one_bits), -18446744073709551615L)
+ 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)
# 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)), long))
+ self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 2)), int))
if sys.maxint == 9223372036854775807:
def test_32_63_bit_values(self):
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index 4aa799d..afc7cae 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -93,7 +93,7 @@ class ComplexTest(unittest.TestCase):
self.assertRaises(ZeroDivisionError, complex.__floordiv__, 3+0j, 0+0j)
def test_richcompare(self):
- self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1L<<10000)
+ self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1<<10000)
self.assertEqual(complex.__lt__(1+1j, None), NotImplemented)
self.assertIs(complex.__eq__(1+1j, 1+1j), True)
self.assertIs(complex.__eq__(1+1j, 2+2j), False)
@@ -180,25 +180,25 @@ class ComplexTest(unittest.TestCase):
self.assertAlmostEqual(complex("1+10j"), 1+10j)
self.assertAlmostEqual(complex(10), 10+0j)
self.assertAlmostEqual(complex(10.0), 10+0j)
- self.assertAlmostEqual(complex(10L), 10+0j)
+ self.assertAlmostEqual(complex(10), 10+0j)
self.assertAlmostEqual(complex(10+0j), 10+0j)
self.assertAlmostEqual(complex(1,10), 1+10j)
- self.assertAlmostEqual(complex(1,10L), 1+10j)
+ self.assertAlmostEqual(complex(1,10), 1+10j)
+ self.assertAlmostEqual(complex(1,10.0), 1+10j)
+ self.assertAlmostEqual(complex(1,10), 1+10j)
+ self.assertAlmostEqual(complex(1,10), 1+10j)
self.assertAlmostEqual(complex(1,10.0), 1+10j)
- self.assertAlmostEqual(complex(1L,10), 1+10j)
- self.assertAlmostEqual(complex(1L,10L), 1+10j)
- self.assertAlmostEqual(complex(1L,10.0), 1+10j)
self.assertAlmostEqual(complex(1.0,10), 1+10j)
- self.assertAlmostEqual(complex(1.0,10L), 1+10j)
+ self.assertAlmostEqual(complex(1.0,10), 1+10j)
self.assertAlmostEqual(complex(1.0,10.0), 1+10j)
self.assertAlmostEqual(complex(3.14+0j), 3.14+0j)
self.assertAlmostEqual(complex(3.14), 3.14+0j)
self.assertAlmostEqual(complex(314), 314.0+0j)
- self.assertAlmostEqual(complex(314L), 314.0+0j)
+ self.assertAlmostEqual(complex(314), 314.0+0j)
self.assertAlmostEqual(complex(3.14+0j, 0j), 3.14+0j)
self.assertAlmostEqual(complex(3.14, 0.0), 3.14+0j)
self.assertAlmostEqual(complex(314, 0), 314.0+0j)
- self.assertAlmostEqual(complex(314L, 0L), 314.0+0j)
+ self.assertAlmostEqual(complex(314, 0), 314.0+0j)
self.assertAlmostEqual(complex(0j, 3.14j), -3.14+0j)
self.assertAlmostEqual(complex(0.0, 3.14j), -3.14+0j)
self.assertAlmostEqual(complex(0j, 3.14), 3.14j)
@@ -232,7 +232,7 @@ class ComplexTest(unittest.TestCase):
self.assertRaises(ValueError, complex, '1+1j\0j')
self.assertRaises(TypeError, int, 5+3j)
- self.assertRaises(TypeError, long, 5+3j)
+ self.assertRaises(TypeError, int, 5+3j)
self.assertRaises(TypeError, float, 5+3j)
self.assertRaises(ValueError, complex, "")
self.assertRaises(TypeError, complex, None)
diff --git a/Lib/test/test_cookielib.py b/Lib/test/test_cookielib.py
index 9b06869..cb9dffb 100644
--- a/Lib/test/test_cookielib.py
+++ b/Lib/test/test_cookielib.py
@@ -103,7 +103,7 @@ class HeaderTests(TestCase):
from cookielib import parse_ns_headers
# quotes should be stripped
- expected = [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]]
+ expected = [[('foo', 'bar'), ('expires', 2209069412), ('version', '0')]]
for hdr in [
'foo=bar; expires=01 Jan 2040 22:23:32 GMT',
'foo=bar; expires="01 Jan 2040 22:23:32 GMT"',
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 416a755..8a32866 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -82,7 +82,7 @@ class TestCopy(unittest.TestCase):
pass
def f():
pass
- tests = [None, 42, 2L**100, 3.14, True, False, 1j,
+ tests = [None, 42, 2**100, 3.14, True, False, 1j,
"hello", u"hello\u1234", f.func_code,
NewStyle, xrange(10), Classic, max]
for x in tests:
@@ -255,7 +255,7 @@ class TestCopy(unittest.TestCase):
pass
def f():
pass
- tests = [None, 42, 2L**100, 3.14, True, False, 1j,
+ tests = [None, 42, 2**100, 3.14, True, False, 1j,
"hello", u"hello\u1234", f.func_code,
NewStyle, xrange(10), Classic, max]
for x in tests:
diff --git a/Lib/test/test_copy_reg.py b/Lib/test/test_copy_reg.py
index c3d3964..34ca4ec 100644
--- a/Lib/test/test_copy_reg.py
+++ b/Lib/test/test_copy_reg.py
@@ -96,7 +96,7 @@ class CopyRegTestCase(unittest.TestCase):
e.restore()
# Ensure invalid codes blow up.
- for code in -1, 0, 0x80000000L:
+ for code in -1, 0, 0x80000000:
self.assertRaises(ValueError, copy_reg.add_extension,
mod, func, code)
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 3329104..b32017e 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -32,7 +32,7 @@ else:
# An arbitrary collection of objects of non-datetime types, for testing
# mixed-type comparisons.
-OTHERSTUFF = (10, 10L, 34.5, "abc", {}, [], ())
+OTHERSTUFF = (10, 10, 34.5, "abc", {}, [], ())
#############################################################################
@@ -149,11 +149,11 @@ class HarmlessMixedComparison(unittest.TestCase):
self.failIf(() == me)
self.failUnless(() != me)
- self.failUnless(me in [1, 20L, [], me])
- self.failIf(me not in [1, 20L, [], me])
+ self.failUnless(me in [1, 20, [], me])
+ self.failIf(me not in [1, 20, [], me])
- self.failUnless([] in [me, 1, 20L, []])
- self.failIf([] not in [me, 1, 20L, []])
+ self.failUnless([] in [me, 1, 20, []])
+ self.failIf([] not in [me, 1, 20, []])
def test_harmful_mixed_comparison(self):
me = self.theclass(1, 1, 1)
@@ -222,13 +222,13 @@ class TestTimeDelta(HarmlessMixedComparison):
eq(td(0, 0, 60*1000000), b)
eq(a*10, td(70))
eq(a*10, 10*a)
- eq(a*10L, 10*a)
+ eq(a*10, 10*a)
eq(b*10, td(0, 600))
eq(10*b, td(0, 600))
- eq(b*10L, td(0, 600))
+ eq(b*10, td(0, 600))
eq(c*10, td(0, 0, 10000))
eq(10*c, td(0, 0, 10000))
- eq(c*10L, td(0, 0, 10000))
+ eq(c*10, td(0, 0, 10000))
eq(a*-1, -a)
eq(b*-2, -b-b)
eq(c*-2, -c+-c)
@@ -246,7 +246,7 @@ class TestTimeDelta(HarmlessMixedComparison):
a = timedelta(42)
# Add/sub ints, longs, floats should be illegal
- for i in 1, 1L, 1.0:
+ for i in 1, 1, 1.0:
self.assertRaises(TypeError, lambda: a+i)
self.assertRaises(TypeError, lambda: a-i)
self.assertRaises(TypeError, lambda: i+a)
@@ -263,7 +263,7 @@ class TestTimeDelta(HarmlessMixedComparison):
# Divison of int by timedelta doesn't make sense.
# Division by zero doesn't make sense.
- for zero in 0, 0L:
+ for zero in 0, 0:
self.assertRaises(TypeError, lambda: zero // a)
self.assertRaises(ZeroDivisionError, lambda: a // zero)
@@ -696,7 +696,7 @@ class TestDate(HarmlessMixedComparison):
self.assertEqual(a - (a - day), day)
# Add/sub ints, longs, floats should be illegal
- for i in 1, 1L, 1.0:
+ for i in 1, 1, 1.0:
self.assertRaises(TypeError, lambda: a+i)
self.assertRaises(TypeError, lambda: a-i)
self.assertRaises(TypeError, lambda: i+a)
@@ -1325,7 +1325,7 @@ class TestDateTime(TestDate):
self.assertEqual(a - (week + day + hour + millisec),
(((a - week) - day) - hour) - millisec)
# Add/sub ints, longs, floats should be illegal
- for i in 1, 1L, 1.0:
+ for i in 1, 1, 1.0:
self.assertRaises(TypeError, lambda: a+i)
self.assertRaises(TypeError, lambda: a-i)
self.assertRaises(TypeError, lambda: i+a)
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index f9a9e82..4a53122 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -907,8 +907,8 @@ class DecimalUsabilityTest(unittest.TestCase):
self.assertEqual(int(d2), 15)
#long
- self.assertEqual(long(d1), 66)
- self.assertEqual(long(d2), 15)
+ self.assertEqual(int(d1), 66)
+ self.assertEqual(int(d2), 15)
#float
self.assertEqual(float(d1), 66)
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index bc95226..bcfadf7 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -191,7 +191,7 @@ def dict_constructor():
vereq(d, dict([("two", 2)], one=1))
vereq(d, dict([("one", 100), ("two", 200)], **d))
verify(d is not dict(**d))
- for badarg in 0, 0L, 0j, "0", [0], (0,):
+ for badarg in 0, 0, 0j, "0", [0], (0,):
try:
dict(badarg)
except TypeError:
@@ -264,7 +264,7 @@ def test_dir():
del junk
# Just make sure these don't blow up!
- for arg in 2, 2L, 2j, 2e0, [2], "2", u"2", (2,), {2:2}, type, test_dir:
+ for arg in 2, 2, 2j, 2e0, [2], "2", u"2", (2,), {2:2}, type, test_dir:
dir(arg)
# Test dir on custom classes. Since these have object as a
@@ -385,7 +385,6 @@ unops = {
'abs': 'abs',
'invert': '~',
'int': 'int',
- 'long': 'long',
'float': 'float',
'oct': 'oct',
'hex': 'hex',
@@ -423,7 +422,7 @@ def ints():
class C(int):
def __add__(self, other):
return NotImplemented
- vereq(C(5L), 5)
+ vereq(C(5), 5)
try:
C() + ""
except TypeError:
@@ -433,7 +432,7 @@ def ints():
def longs():
if verbose: print "Testing long operations..."
- numops(100L, 3L)
+ numops(100, 3)
def floats():
if verbose: print "Testing float operations..."
@@ -1263,10 +1262,10 @@ def dynamics():
vereq(I(3)*I(2), 6)
# Test handling of long*seq and seq*long
- class L(long):
+ class L(int):
pass
- vereq("a"*L(2L), "aa")
- vereq(L(2L)*"a", "aa")
+ vereq("a"*L(2), "aa")
+ vereq(L(2)*"a", "aa")
vereq(2*L(3), 6)
vereq(L(3)*2, 6)
vereq(L(3)*L(2), 6)
@@ -2041,7 +2040,7 @@ def inherits():
verify((hexint(0) << 12).__class__ is int)
verify((hexint(0) >> 12).__class__ is int)
- class octlong(long):
+ class octlong(int):
__slots__ = []
def __str__(self):
s = oct(self)
@@ -2056,39 +2055,39 @@ def inherits():
# because the example uses a short int left argument.)
vereq(str(5 + octlong(3000)), "05675")
a = octlong(12345)
- vereq(a, 12345L)
- vereq(long(a), 12345L)
- vereq(hash(a), hash(12345L))
- verify(long(a).__class__ is long)
- verify((+a).__class__ is long)
- verify((-a).__class__ is long)
- verify((-octlong(0)).__class__ is long)
- verify((a >> 0).__class__ is long)
- verify((a << 0).__class__ is long)
- verify((a - 0).__class__ is long)
- verify((a * 1).__class__ is long)
- verify((a ** 1).__class__ is long)
- verify((a // 1).__class__ is long)
- verify((1 * a).__class__ is long)
- verify((a | 0).__class__ is long)
- verify((a ^ 0).__class__ is long)
- verify((a & -1L).__class__ is long)
- verify((octlong(0) << 12).__class__ is long)
- verify((octlong(0) >> 12).__class__ is long)
- verify(abs(octlong(0)).__class__ is long)
+ vereq(a, 12345)
+ vereq(int(a), 12345)
+ vereq(hash(a), hash(12345))
+ verify(int(a).__class__ is int)
+ verify((+a).__class__ is int)
+ verify((-a).__class__ is int)
+ verify((-octlong(0)).__class__ is int)
+ verify((a >> 0).__class__ is int)
+ verify((a << 0).__class__ is int)
+ verify((a - 0).__class__ is int)
+ verify((a * 1).__class__ is int)
+ verify((a ** 1).__class__ is int)
+ verify((a // 1).__class__ is int)
+ verify((1 * a).__class__ is int)
+ verify((a | 0).__class__ is int)
+ verify((a ^ 0).__class__ is int)
+ verify((a & -1).__class__ is int)
+ verify((octlong(0) << 12).__class__ is int)
+ verify((octlong(0) >> 12).__class__ is int)
+ verify(abs(octlong(0)).__class__ is int)
# Because octlong overrides __add__, we can't check the absence of +0
# optimizations using octlong.
- class longclone(long):
+ class longclone(int):
pass
a = longclone(1)
- verify((a + 0).__class__ is long)
- verify((0 + a).__class__ is long)
+ verify((a + 0).__class__ is int)
+ verify((0 + a).__class__ is int)
# Check that negative clones don't segfault
a = longclone(-1)
vereq(a.__dict__, {})
- vereq(long(a), -1) # verify PyNumber_Long() copies the sign bit
+ vereq(int(a), -1) # verify PyNumber_Long() copies the sign bit
class precfloat(float):
__slots__ = ['prec']
@@ -2366,7 +2365,7 @@ def keywords():
print "Testing keyword args to basic type constructors ..."
vereq(int(x=1), 1)
vereq(float(x=2), 2.0)
- vereq(long(x=3), 3L)
+ vereq(int(x=3), 3)
vereq(complex(imag=42, real=666), complex(666, 42))
vereq(str(object=500), '500')
vereq(unicode(string='abc', errors='strict'), u'abc')
@@ -2374,7 +2373,7 @@ def keywords():
vereq(list(sequence=(0, 1, 2)), range(3))
# note: as of Python 2.3, dict() no longer has an "items" keyword arg
- for constructor in (int, float, long, complex, str, unicode,
+ for constructor in (int, float, int, complex, str, unicode,
tuple, list, file):
try:
constructor(bogus_keyword_arg=1)
@@ -2472,37 +2471,37 @@ def classic_comparisons():
def __eq__(self, other):
if isinstance(other, C):
return self.value == other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value == other
return NotImplemented
def __ne__(self, other):
if isinstance(other, C):
return self.value != other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value != other
return NotImplemented
def __lt__(self, other):
if isinstance(other, C):
return self.value < other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value < other
return NotImplemented
def __le__(self, other):
if isinstance(other, C):
return self.value <= other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value <= other
return NotImplemented
def __gt__(self, other):
if isinstance(other, C):
return self.value > other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value > other
return NotImplemented
def __ge__(self, other):
if isinstance(other, C):
return self.value >= other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value >= other
return NotImplemented
@@ -2550,37 +2549,37 @@ def rich_comparisons():
def __eq__(self, other):
if isinstance(other, C):
return self.value == other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value == other
return NotImplemented
def __ne__(self, other):
if isinstance(other, C):
return self.value != other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value != other
return NotImplemented
def __lt__(self, other):
if isinstance(other, C):
return self.value < other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value < other
return NotImplemented
def __le__(self, other):
if isinstance(other, C):
return self.value <= other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value <= other
return NotImplemented
def __gt__(self, other):
if isinstance(other, C):
return self.value > other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value > other
return NotImplemented
def __ge__(self, other):
if isinstance(other, C):
return self.value >= other.value
- if isinstance(other, int) or isinstance(other, long):
+ if isinstance(other, int) or isinstance(other, int):
return self.value >= other
return NotImplemented
c1 = C(1)
@@ -3250,11 +3249,11 @@ def imulbug():
y *= 2
vereq(y, (x, 2))
y = x
- y *= 3L
- vereq(y, (x, 3L))
+ y *= 3
+ vereq(y, (x, 3))
y = x
- y *= 1L<<100
- vereq(y, (x, 1L<<100))
+ y *= 1<<100
+ vereq(y, (x, 1<<100))
y = x
y *= None
vereq(y, (x, None))
@@ -3444,7 +3443,7 @@ def do_this_first():
def __pow__(self, *args):
pass
try:
- pow(0L, UserLong(), 0L)
+ pow(0, UserLong(), 0)
except:
pass
@@ -3956,7 +3955,7 @@ def notimplemented():
else:
raise TestFailed("no TypeError from %r" % (expr,))
- N1 = sys.maxint + 1L # might trigger OverflowErrors instead of TypeErrors
+ N1 = sys.maxint + 1 # might trigger OverflowErrors instead of TypeErrors
N2 = sys.maxint # if sizeof(int) < sizeof(long), might trigger
# ValueErrors instead of TypeErrors
for metaclass in [type, types.ClassType]:
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index c7fa15d..1042cb1 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -314,7 +314,7 @@ class DictTest(unittest.TestCase):
# verify longs/ints get same value when key > 32 bits (for 64-bit archs)
# see SF bug #689659
- x = 4503599627370496L
+ x = 4503599627370496
y = 4503599627370496
h = {x: 'anything', y: 'something else'}
self.assertEqual(h[x], h[y])
@@ -371,7 +371,7 @@ class DictTest(unittest.TestCase):
def test_eq(self):
self.assertEqual({}, {})
- self.assertEqual({1: 2}, {1L: 2L})
+ self.assertEqual({1: 2}, {1: 2})
class Exc(Exception): pass
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index fc8a5a1..df78a32 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -57,14 +57,14 @@ testboth('%12.*f', (123456, 1.0))
# Formatting of long integers. Overflow is not ok
overflowok = 0
-testboth("%x", 10L, "a")
-testboth("%x", 100000000000L, "174876e800")
-testboth("%o", 10L, "12")
-testboth("%o", 100000000000L, "1351035564000")
-testboth("%d", 10L, "10")
-testboth("%d", 100000000000L, "100000000000")
-
-big = 123456789012345678901234567890L
+testboth("%x", 10, "a")
+testboth("%x", 100000000000, "174876e800")
+testboth("%o", 10, "12")
+testboth("%o", 100000000000, "1351035564000")
+testboth("%d", 10, "10")
+testboth("%d", 100000000000, "100000000000")
+
+big = 123456789012345678901234567890
testboth("%d", big, "123456789012345678901234567890")
testboth("%d", -big, "-123456789012345678901234567890")
testboth("%5d", -big, "-123456789012345678901234567890")
@@ -83,7 +83,7 @@ testboth("%.30d", big, "123456789012345678901234567890")
testboth("%.31d", big, "0123456789012345678901234567890")
testboth("%32.31d", big, " 0123456789012345678901234567890")
-big = 0x1234567890abcdef12345L # 21 hex digits
+big = 0x1234567890abcdef12345 # 21 hex digits
testboth("%x", big, "1234567890abcdef12345")
testboth("%x", -big, "-1234567890abcdef12345")
testboth("%5x", -big, "-1234567890abcdef12345")
@@ -120,7 +120,7 @@ testboth("%#+027.23X", big, "+0X0001234567890ABCDEF12345")
# same, except no 0 flag
testboth("%#+27.23X", big, " +0X001234567890ABCDEF12345")
-big = 012345670123456701234567012345670L # 32 octal digits
+big = 012345670123456701234567012345670 # 32 octal digits
testboth("%o", big, "12345670123456701234567012345670")
testboth("%o", -big, "-12345670123456701234567012345670")
testboth("%5o", -big, "-12345670123456701234567012345670")
@@ -163,34 +163,34 @@ testboth("%0#34.33o", big, "0012345670123456701234567012345670")
# Some small ints, in both Python int and long flavors).
testboth("%d", 42, "42")
testboth("%d", -42, "-42")
-testboth("%d", 42L, "42")
-testboth("%d", -42L, "-42")
+testboth("%d", 42, "42")
+testboth("%d", -42, "-42")
testboth("%#x", 1, "0x1")
-testboth("%#x", 1L, "0x1")
+testboth("%#x", 1, "0x1")
+testboth("%#X", 1, "0X1")
testboth("%#X", 1, "0X1")
-testboth("%#X", 1L, "0X1")
testboth("%#o", 1, "01")
-testboth("%#o", 1L, "01")
+testboth("%#o", 1, "01")
+testboth("%#o", 0, "0")
testboth("%#o", 0, "0")
-testboth("%#o", 0L, "0")
testboth("%o", 0, "0")
-testboth("%o", 0L, "0")
+testboth("%o", 0, "0")
testboth("%d", 0, "0")
-testboth("%d", 0L, "0")
+testboth("%d", 0, "0")
+testboth("%#x", 0, "0x0")
testboth("%#x", 0, "0x0")
-testboth("%#x", 0L, "0x0")
testboth("%#X", 0, "0X0")
-testboth("%#X", 0L, "0X0")
+testboth("%#X", 0, "0X0")
testboth("%x", 0x42, "42")
testboth("%x", -0x42, "-42")
-testboth("%x", 0x42L, "42")
-testboth("%x", -0x42L, "-42")
+testboth("%x", 0x42, "42")
+testboth("%x", -0x42, "-42")
testboth("%o", 042, "42")
testboth("%o", -042, "-42")
-testboth("%o", 042L, "42")
-testboth("%o", -042L, "-42")
+testboth("%o", 042, "42")
+testboth("%o", -042, "-42")
# Test exception for unknown format characters
if verbose:
@@ -230,7 +230,7 @@ test_exc(u'no format', '1', TypeError,
test_exc(u'no format', u'1', TypeError,
"not all arguments converted during string formatting")
-class Foobar(long):
+class Foobar(int):
def __oct__(self):
# Returning a non-string should not blow up.
return self + 1
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index edc17fc..828331e 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -293,8 +293,8 @@ class TestReduce(unittest.TestCase):
)
self.assertEqual(self.func(lambda x, y: x*y, range(2,8), 1), 5040)
self.assertEqual(
- self.func(lambda x, y: x*y, range(2,21), 1L),
- 2432902008176640000L
+ self.func(lambda x, y: x*y, range(2,21), 1),
+ 2432902008176640000
)
self.assertEqual(self.func(lambda x, y: x+y, Squares(10)), 285)
self.assertEqual(self.func(lambda x, y: x+y, Squares(10), 0), 285)
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 30df034..a40d8ea 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1057,9 +1057,9 @@ class Queens:
# generates the possiblities for the columns in that row.
self.rowgenerators = []
for i in rangen:
- rowuses = [(1L << j) | # column ordinal
- (1L << (n + i-j + n-1)) | # NW-SE ordinal
- (1L << (n + 2*n-1 + i+j)) # NE-SW ordinal
+ rowuses = [(1 << j) | # column ordinal
+ (1 << (n + i-j + n-1)) | # NW-SE ordinal
+ (1 << (n + 2*n-1 + i+j)) # NE-SW ordinal
for j in rangen]
def rowgen(rowuses=rowuses):
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index c428f45..9172576 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -45,7 +45,7 @@ long long (if that exists).
"""
LARGE = 0x7FFFFFFF
-VERY_LARGE = 0xFF0000121212121212121242L
+VERY_LARGE = 0xFF0000121212121212121242
from _testcapi import UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, INT_MAX, \
INT_MIN, LONG_MIN, LONG_MAX, PY_SSIZE_T_MIN, PY_SSIZE_T_MAX
@@ -57,7 +57,7 @@ ULLONG_MAX = 2**64-1
class Long:
def __int__(self):
- return 99L
+ return 99
class Int:
def __int__(self):
@@ -77,7 +77,7 @@ class Unsigned_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_b, UCHAR_MAX + 1)
self.failUnlessEqual(42, getargs_b(42))
- self.failUnlessEqual(42, getargs_b(42L))
+ self.failUnlessEqual(42, getargs_b(42))
self.assertRaises(OverflowError, getargs_b, VERY_LARGE)
def test_B(self):
@@ -88,13 +88,13 @@ class Unsigned_TestCase(unittest.TestCase):
self.failUnlessEqual(99, getargs_B(Int()))
self.failUnlessEqual(UCHAR_MAX, getargs_B(-1))
- self.failUnlessEqual(UCHAR_MAX, getargs_B(-1L))
+ self.failUnlessEqual(UCHAR_MAX, getargs_B(-1))
self.failUnlessEqual(0, getargs_B(0))
self.failUnlessEqual(UCHAR_MAX, getargs_B(UCHAR_MAX))
self.failUnlessEqual(0, getargs_B(UCHAR_MAX+1))
self.failUnlessEqual(42, getargs_B(42))
- self.failUnlessEqual(42, getargs_B(42L))
+ self.failUnlessEqual(42, getargs_B(42))
self.failUnlessEqual(UCHAR_MAX & VERY_LARGE, getargs_B(VERY_LARGE))
def test_H(self):
@@ -110,7 +110,7 @@ class Unsigned_TestCase(unittest.TestCase):
self.failUnlessEqual(0, getargs_H(USHRT_MAX+1))
self.failUnlessEqual(42, getargs_H(42))
- self.failUnlessEqual(42, getargs_H(42L))
+ self.failUnlessEqual(42, getargs_H(42))
self.failUnlessEqual(VERY_LARGE & USHRT_MAX, getargs_H(VERY_LARGE))
@@ -127,7 +127,7 @@ class Unsigned_TestCase(unittest.TestCase):
self.failUnlessEqual(0, getargs_I(UINT_MAX+1))
self.failUnlessEqual(42, getargs_I(42))
- self.failUnlessEqual(42, getargs_I(42L))
+ self.failUnlessEqual(42, getargs_I(42))
self.failUnlessEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
@@ -145,7 +145,7 @@ class Unsigned_TestCase(unittest.TestCase):
self.failUnlessEqual(0, getargs_k(ULONG_MAX+1))
self.failUnlessEqual(42, getargs_k(42))
- self.failUnlessEqual(42, getargs_k(42L))
+ self.failUnlessEqual(42, getargs_k(42))
self.failUnlessEqual(VERY_LARGE & ULONG_MAX, getargs_k(VERY_LARGE))
@@ -163,7 +163,7 @@ class Signed_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_i, INT_MAX+1)
self.failUnlessEqual(42, getargs_i(42))
- self.failUnlessEqual(42, getargs_i(42L))
+ self.failUnlessEqual(42, getargs_i(42))
self.assertRaises(OverflowError, getargs_i, VERY_LARGE)
def test_l(self):
@@ -179,7 +179,7 @@ class Signed_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_l, LONG_MAX+1)
self.failUnlessEqual(42, getargs_l(42))
- self.failUnlessEqual(42, getargs_l(42L))
+ self.failUnlessEqual(42, getargs_l(42))
self.assertRaises(OverflowError, getargs_l, VERY_LARGE)
def test_n(self):
@@ -196,7 +196,7 @@ class Signed_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MAX+1)
self.failUnlessEqual(42, getargs_n(42))
- self.failUnlessEqual(42, getargs_n(42L))
+ self.failUnlessEqual(42, getargs_n(42))
self.assertRaises(OverflowError, getargs_n, VERY_LARGE)
@@ -215,7 +215,7 @@ class LongLong_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_L, LLONG_MAX+1)
self.failUnlessEqual(42, getargs_L(42))
- self.failUnlessEqual(42, getargs_L(42L))
+ self.failUnlessEqual(42, getargs_L(42))
self.assertRaises(OverflowError, getargs_L, VERY_LARGE)
def test_K(self):
@@ -229,7 +229,7 @@ class LongLong_TestCase(unittest.TestCase):
self.failUnlessEqual(0, getargs_K(ULLONG_MAX+1))
self.failUnlessEqual(42, getargs_K(42))
- self.failUnlessEqual(42, getargs_K(42L))
+ self.failUnlessEqual(42, getargs_K(42))
self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE))
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 0d36a62..33bfd32 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -55,14 +55,14 @@ class TokenTests(unittest.TestCase):
self.fail('Weird maxint value %r' % maxint)
def testLongIntegers(self):
- x = 0L
- x = 0l
- x = 0xffffffffffffffffL
- x = 0xffffffffffffffffl
- x = 077777777777777777L
- x = 077777777777777777l
- x = 123456789012345678901234567890L
- x = 123456789012345678901234567890l
+ x = 0
+ x = 0
+ x = 0xffffffffffffffff
+ x = 0xffffffffffffffff
+ x = 077777777777777777
+ x = 077777777777777777
+ x = 123456789012345678901234567890
+ x = 123456789012345678901234567890
def testFloats(self):
x = 3.14
@@ -327,7 +327,7 @@ class GrammarTests(unittest.TestCase):
l1 = lambda : 0
self.assertEquals(l1(), 0)
l2 = lambda : a[d] # XXX just testing the expression
- l3 = lambda : [2 < x for x in [-1, 3, 0L]]
+ l3 = lambda : [2 < x for x in [-1, 3, 0]]
self.assertEquals(l3(), [0, 1, 0])
l4 = lambda x = lambda y = lambda z=1 : z : y() : x()
self.assertEquals(l4(), 1)
diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py
index 3d6c9d1..9578537 100644
--- a/Lib/test/test_hash.py
+++ b/Lib/test/test_hash.py
@@ -17,14 +17,14 @@ class HashEqualityTestCase(unittest.TestCase):
self.fail("hashed values differ: %r" % (objlist,))
def test_numeric_literals(self):
- self.same_hash(1, 1L, 1.0, 1.0+0.0j)
+ self.same_hash(1, 1, 1.0, 1.0+0.0j)
def test_coerced_integers(self):
- self.same_hash(int(1), long(1), float(1), complex(1),
+ self.same_hash(int(1), int(1), float(1), complex(1),
int('1'), float('1.0'))
def test_coerced_floats(self):
- self.same_hash(long(1.23e300), float(1.23e300))
+ self.same_hash(int(1.23e300), float(1.23e300))
self.same_hash(float(0.5), complex(0.5, 0.0))
diff --git a/Lib/test/test_hexoct.py b/Lib/test/test_hexoct.py
index f71dbe0..5e86bea 100644
--- a/Lib/test/test_hexoct.py
+++ b/Lib/test/test_hexoct.py
@@ -41,26 +41,26 @@ class TextHexOct(unittest.TestCase):
def test_hex_unsigned(self):
if platform_long_is_32_bits:
# Positive constants
- self.assertEqual(0x80000000, 2147483648L)
- self.assertEqual(0xffffffff, 4294967295L)
+ self.assertEqual(0x80000000, 2147483648)
+ self.assertEqual(0xffffffff, 4294967295)
# Ditto with a minus sign and parentheses
- self.assertEqual(-(0x80000000), -2147483648L)
- self.assertEqual(-(0xffffffff), -4294967295L)
+ self.assertEqual(-(0x80000000), -2147483648)
+ self.assertEqual(-(0xffffffff), -4294967295)
# Ditto with a minus sign and NO parentheses
# This failed in Python 2.2 through 2.2.2 and in 2.3a1
- self.assertEqual(-0x80000000, -2147483648L)
- self.assertEqual(-0xffffffff, -4294967295L)
+ self.assertEqual(-0x80000000, -2147483648)
+ self.assertEqual(-0xffffffff, -4294967295)
else:
# Positive constants
- self.assertEqual(0x8000000000000000, 9223372036854775808L)
- self.assertEqual(0xffffffffffffffff, 18446744073709551615L)
+ self.assertEqual(0x8000000000000000, 9223372036854775808)
+ self.assertEqual(0xffffffffffffffff, 18446744073709551615)
# Ditto with a minus sign and parentheses
- self.assertEqual(-(0x8000000000000000), -9223372036854775808L)
- self.assertEqual(-(0xffffffffffffffff), -18446744073709551615L)
+ self.assertEqual(-(0x8000000000000000), -9223372036854775808)
+ self.assertEqual(-(0xffffffffffffffff), -18446744073709551615)
# Ditto with a minus sign and NO parentheses
# This failed in Python 2.2 through 2.2.2 and in 2.3a1
- self.assertEqual(-0x8000000000000000, -9223372036854775808L)
- self.assertEqual(-0xffffffffffffffff, -18446744073709551615L)
+ self.assertEqual(-0x8000000000000000, -9223372036854775808)
+ self.assertEqual(-0xffffffffffffffff, -18446744073709551615)
def test_oct_baseline(self):
# Baseline tests
@@ -88,26 +88,26 @@ class TextHexOct(unittest.TestCase):
def test_oct_unsigned(self):
if platform_long_is_32_bits:
# Positive constants
- self.assertEqual(020000000000, 2147483648L)
- self.assertEqual(037777777777, 4294967295L)
+ self.assertEqual(020000000000, 2147483648)
+ self.assertEqual(037777777777, 4294967295)
# Ditto with a minus sign and parentheses
- self.assertEqual(-(020000000000), -2147483648L)
- self.assertEqual(-(037777777777), -4294967295L)
+ self.assertEqual(-(020000000000), -2147483648)
+ self.assertEqual(-(037777777777), -4294967295)
# Ditto with a minus sign and NO parentheses
# This failed in Python 2.2 through 2.2.2 and in 2.3a1
- self.assertEqual(-020000000000, -2147483648L)
- self.assertEqual(-037777777777, -4294967295L)
+ self.assertEqual(-020000000000, -2147483648)
+ self.assertEqual(-037777777777, -4294967295)
else:
# Positive constants
- self.assertEqual(01000000000000000000000, 9223372036854775808L)
- self.assertEqual(01777777777777777777777, 18446744073709551615L)
+ self.assertEqual(01000000000000000000000, 9223372036854775808)
+ self.assertEqual(01777777777777777777777, 18446744073709551615)
# Ditto with a minus sign and parentheses
- self.assertEqual(-(01000000000000000000000), -9223372036854775808L)
- self.assertEqual(-(01777777777777777777777), -18446744073709551615L)
+ self.assertEqual(-(01000000000000000000000), -9223372036854775808)
+ self.assertEqual(-(01777777777777777777777), -18446744073709551615)
# Ditto with a minus sign and NO parentheses
# This failed in Python 2.2 through 2.2.2 and in 2.3a1
- self.assertEqual(-01000000000000000000000, -9223372036854775808L)
- self.assertEqual(-01777777777777777777777, -18446744073709551615L)
+ self.assertEqual(-01000000000000000000000, -9223372036854775808)
+ self.assertEqual(-01777777777777777777777, -18446744073709551615)
def test_main():
test_support.run_unittest(TextHexOct)
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index ecb566d..0045469 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -15,7 +15,7 @@ class TrapInt(int):
def __index__(self):
return self
-class TrapLong(long):
+class TrapLong(int):
def __index__(self):
return self
@@ -44,7 +44,7 @@ class BaseTestCase(unittest.TestCase):
self.o.ind = 4
self.n.ind = 5
self.assertEqual(6 .__index__(), 6)
- self.assertEqual(-7L.__index__(), -7)
+ self.assertEqual(-7 .__index__(), -7)
self.assertEqual(self.o.__index__(), 4)
self.assertEqual(self.n.__index__(), 5)
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
index 25b0816..cc2b5fd 100644
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -242,7 +242,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
self.assertEqual(False, issubclass(NewChild, ()))
self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,))))
- self.assertEqual(True, issubclass(int, (long, (float, int))))
+ self.assertEqual(True, issubclass(int, (int, (float, int))))
if test_support.have_unicode:
self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring))))
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py
index 4dca97f..d7ed1b3 100644
--- a/Lib/test/test_largefile.py
+++ b/Lib/test/test_largefile.py
@@ -19,7 +19,7 @@ except (ImportError, AttributeError):
# create >2GB file (2GB = 2147483648 bytes)
-size = 2500000000L
+size = 2500000000
name = test_support.TESTFN
@@ -37,7 +37,7 @@ else:
f = open(test_support.TESTFN, 'wb')
try:
# 2**31 == 2147483648
- f.seek(2147483649L)
+ f.seek(2147483649)
# Seeking is not enough of a test: you must write and flush, too!
f.write("x")
f.flush()
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index e0c781f..2876f83 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -23,11 +23,11 @@ KARATSUBA_CUTOFF = 70 # from longobject.c
MAXDIGITS = 15
# build some special values
-special = map(long, [0, 1, 2, BASE, BASE >> 1])
-special.append(0x5555555555555555L)
-special.append(0xaaaaaaaaaaaaaaaaL)
+special = map(int, [0, 1, 2, BASE, BASE >> 1])
+special.append(0x5555555555555555)
+special.append(0xaaaaaaaaaaaaaaaa)
# some solid strings of one bits
-p2 = 4L # 0 and 1 already added
+p2 = 4 # 0 and 1 already added
for i in range(2*SHIFT):
special.append(p2 - 1)
p2 = p2 << 1
@@ -49,7 +49,7 @@ class LongTest(unittest.TestCase):
self.assert_(ndigits > 0)
nbits_hi = ndigits * SHIFT
nbits_lo = nbits_hi - SHIFT + 1
- answer = 0L
+ answer = 0
nbits = 0
r = int(random.random() * (SHIFT * 2)) | 1 # force 1 bits to start
while nbits < nbits_lo:
@@ -70,7 +70,7 @@ class LongTest(unittest.TestCase):
# BASE). The sign bit is also random.
def getran2(ndigits):
- answer = 0L
+ answer = 0
for i in xrange(ndigits):
answer = (answer << SHIFT) | random.randint(0, MASK)
if random.random() < 0.5:
@@ -98,7 +98,7 @@ class LongTest(unittest.TestCase):
for lenx in digits:
x = self.getran(lenx)
for leny in digits:
- y = self.getran(leny) or 1L
+ y = self.getran(leny) or 1
self.check_division(x, y)
def test_karatsuba(self):
@@ -110,15 +110,15 @@ class LongTest(unittest.TestCase):
# Test products of long strings of 1 bits -- (2**x-1)*(2**y-1) ==
# 2**(x+y) - 2**x - 2**y + 1, so the proper result is easy to check.
for abits in bits:
- a = (1L << abits) - 1
+ a = (1 << abits) - 1
for bbits in bits:
if bbits < abits:
continue
- b = (1L << bbits) - 1
+ b = (1 << bbits) - 1
x = a * b
- y = ((1L << (abits + bbits)) -
- (1L << abits) -
- (1L << bbits) +
+ y = ((1 << (abits + bbits)) -
+ (1 << abits) -
+ (1 << bbits) +
1)
self.assertEqual(x, y,
Frm("bad result for a*b: a=%r, b=%r, x=%r, y=%r", a, b, x, y))
@@ -141,7 +141,7 @@ class LongTest(unittest.TestCase):
eq(-x, 1 + ~x, Frm("not -x == 1 + ~x for x=%r", x))
eq(-x, ~(x-1), Frm("not -x == ~(x-1) forx =%r", x))
for n in xrange(2*SHIFT):
- p2 = 2L ** n
+ p2 = 2 ** n
eq(x << n >> n, x,
Frm("x << n >> n != x for x=%r, n=%r", (x, n)))
eq(x // p2, x >> n,
@@ -217,7 +217,7 @@ class LongTest(unittest.TestCase):
msg = Frm("%s returned %r but expected %r for %r",
mapper.__name__, got, expected, x)
self.assertEqual(got, expected, msg)
- self.assertEqual(long(got, 0), x, Frm('long("%s", 0) != %r', got, x))
+ self.assertEqual(int(got, 0), x, Frm('long("%s", 0) != %r', got, x))
# str() has to be checked a little differently since there's no
# trailing "L"
got = str(x)
@@ -240,8 +240,8 @@ class LongTest(unittest.TestCase):
# check the extremes in int<->long conversion
hugepos = sys.maxint
hugeneg = -hugepos - 1
- hugepos_aslong = long(hugepos)
- hugeneg_aslong = long(hugeneg)
+ hugepos_aslong = int(hugepos)
+ hugeneg_aslong = int(hugeneg)
self.assertEqual(hugepos, hugepos_aslong, "long(sys.maxint) != sys.maxint")
self.assertEqual(hugeneg, hugeneg_aslong,
"long(-sys.maxint-1) != -sys.maxint-1")
@@ -270,7 +270,7 @@ class LongTest(unittest.TestCase):
y = int(x)
except OverflowError:
self.fail("int(long(sys.maxint) + 1) mustn't overflow")
- self.assert_(isinstance(y, long),
+ self.assert_(isinstance(y, int),
"int(long(sys.maxint) + 1) should have returned long")
x = hugeneg_aslong - 1
@@ -278,14 +278,14 @@ class LongTest(unittest.TestCase):
y = int(x)
except OverflowError:
self.fail("int(long(-sys.maxint-1) - 1) mustn't overflow")
- self.assert_(isinstance(y, long),
+ self.assert_(isinstance(y, int),
"int(long(-sys.maxint-1) - 1) should have returned long")
- class long2(long):
+ class long2(int):
pass
- x = long2(1L<<100)
+ x = long2(1<<100)
y = int(x)
- self.assert_(type(y) is long,
+ self.assert_(type(y) is int,
"overflowing int conversion must return long not long subtype")
# long -> Py_ssize_t conversion
@@ -293,10 +293,10 @@ class LongTest(unittest.TestCase):
def __getslice__(self, i, j):
return i, j
- self.assertEqual(X()[-5L:7L], (-5, 7))
+ self.assertEqual(X()[-5:7], (-5, 7))
# use the clamping effect to test the smallest and largest longs
# that fit a Py_ssize_t
- slicemin, slicemax = X()[-2L**100:2L**100]
+ slicemin, slicemax = X()[-2**100:2**100]
self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax))
# ----------------------------------- tests of auto int->long conversion
@@ -315,14 +315,14 @@ class LongTest(unittest.TestCase):
Frm("for %r expected %r got %r", args, expected, got))
for x in special:
- longx = long(x)
+ longx = int(x)
expected = -longx
got = -x
checkit('-', x)
for y in special:
- longy = long(y)
+ longy = int(y)
expected = longx + longy
got = x + y
@@ -357,20 +357,20 @@ class LongTest(unittest.TestCase):
for z in special:
if z != 0 :
if y >= 0:
- expected = pow(longx, longy, long(z))
+ expected = pow(longx, longy, int(z))
got = pow(x, y, z)
checkit('pow', x, y, '%', z)
else:
- self.assertRaises(TypeError, pow,longx, longy, long(z))
+ self.assertRaises(TypeError, pow,longx, longy, int(z))
def test_float_overflow(self):
import math
for x in -2.0, -1.0, 0.0, 1.0, 2.0:
- self.assertEqual(float(long(x)), x)
+ self.assertEqual(float(int(x)), x)
shuge = '12345' * 120
- huge = 1L << 30000
+ huge = 1 << 30000
mhuge = -huge
namespace = {'huge': huge, 'mhuge': mhuge, 'shuge': shuge, 'math': math}
for test in ["float(huge)", "float(mhuge)",
@@ -410,7 +410,7 @@ class LongTest(unittest.TestCase):
log = math.log(value)
self.assertAlmostEqual(log, expected)
- for bad in -(1L << 10000), -2L, 0L:
+ for bad in -(1 << 10000), -2, 0:
self.assertRaises(ValueError, math.log, bad)
self.assertRaises(ValueError, math.log10, bad)
@@ -426,7 +426,7 @@ class LongTest(unittest.TestCase):
# represents all Python ints, longs and floats exactly).
class Rat:
def __init__(self, value):
- if isinstance(value, (int, long)):
+ if isinstance(value, (int, int)):
self.n = value
self.d = 1
elif isinstance(value, float):
@@ -475,12 +475,12 @@ class LongTest(unittest.TestCase):
# important boundary for IEEE double precision.
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,
- long(t-1), long(t), long(t+1)])
+ int(t-1), int(t), int(t+1)])
cases.extend([0, 1, 2, sys.maxint, float(sys.maxint)])
# 1L<<20000 should exceed all double formats. long(1e200) is to
# check that we get equality with 1e200 above.
- t = long(1e200)
- cases.extend([0L, 1L, 2L, 1L << 20000, t-1, t, t+1])
+ t = int(1e200)
+ cases.extend([0, 1, 2, 1 << 20000, t-1, t, t+1])
cases.extend([-x for x in cases])
for x in cases:
Rx = Rat(x)
diff --git a/Lib/test/test_long_future.py b/Lib/test/test_long_future.py
index 074c148..3f137d6 100644
--- a/Lib/test/test_long_future.py
+++ b/Lib/test/test_long_future.py
@@ -8,16 +8,16 @@ from test.test_support import TestFailed, verify, verbose
def test_true_division():
if verbose:
print "long true division"
- huge = 1L << 40000
+ huge = 1 << 40000
mhuge = -huge
verify(huge / huge == 1.0)
verify(mhuge / mhuge == 1.0)
verify(huge / mhuge == -1.0)
verify(mhuge / huge == -1.0)
verify(1 / huge == 0.0)
- verify(1L / huge == 0.0)
+ verify(1 / huge == 0.0)
+ verify(1 / mhuge == 0.0)
verify(1 / mhuge == 0.0)
- verify(1L / mhuge == 0.0)
verify((666 * huge + (huge >> 1)) / huge == 666.5)
verify((666 * mhuge + (mhuge >> 1)) / mhuge == 666.5)
verify((666 * huge + (huge >> 1)) / mhuge == -666.5)
@@ -28,8 +28,8 @@ def test_true_division():
namespace = {'huge': huge, 'mhuge': mhuge}
for overflow in ["float(huge)", "float(mhuge)",
- "huge / 1", "huge / 2L", "huge / -1", "huge / -2L",
- "mhuge / 100", "mhuge / 100L"]:
+ "huge / 1", "huge / 2", "huge / -1", "huge / -2",
+ "mhuge / 100", "mhuge / 100"]:
try:
eval(overflow, namespace)
except OverflowError:
@@ -37,14 +37,14 @@ def test_true_division():
else:
raise TestFailed("expected OverflowError from %r" % overflow)
- for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge",
- "100 / mhuge", "100L / mhuge"]:
+ for underflow in ["1 / huge", "2 / huge", "-1 / huge", "-2 / huge",
+ "100 / mhuge", "100 / mhuge"]:
result = eval(underflow, namespace)
if result != 0.0:
raise TestFailed("expected underflow to 0 from %r" % underflow)
- for zero in ["huge / 0", "huge / 0L",
- "mhuge / 0", "mhuge / 0L"]:
+ for zero in ["huge / 0", "huge / 0",
+ "mhuge / 0", "mhuge / 0"]:
try:
eval(zero, namespace)
except ZeroDivisionError:
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index fa1f688..bcd2918 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -33,7 +33,7 @@ class IntTestCase(unittest.TestCase):
value >>= 8
return ''.join(bytes)
- maxint64 = (1L << 63) - 1
+ maxint64 = (1 << 63) - 1
minint64 = -maxint64-1
for base in maxint64, minint64, -maxint64, -(minint64 >> 1):
@@ -152,7 +152,7 @@ class ContainerTestCase(unittest.TestCase):
d = {'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,
'anint': 2**20,
- 'ashortlong': 2L,
+ 'ashortlong': 2,
'alist': ['.zyx.41'],
'atuple': ('.zyx.41',)*10,
'aboolean': False,
@@ -204,7 +204,7 @@ class BugsTestCase(unittest.TestCase):
def test_patch_873224(self):
self.assertRaises(Exception, marshal.loads, '0')
self.assertRaises(Exception, marshal.loads, 'f')
- self.assertRaises(Exception, marshal.loads, marshal.dumps(2**65L)[:-1])
+ self.assertRaises(Exception, marshal.loads, marshal.dumps(2**65)[:-1])
def test_version_argument(self):
# Python 2.4.0 crashes for any call to marshal.dumps(x, y)
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 50ed481..d94d115 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -98,7 +98,7 @@ class TestBase:
def test_callback_long_index(self):
def myreplace(exc):
- return (u'x', long(exc.end))
+ return (u'x', int(exc.end))
codecs.register_error("test.cjktest", myreplace)
self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh',
'test.cjktest'), ('abcdxefgh', 9))
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index 152d5ec..c71a4e6 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -199,7 +199,7 @@ class OperatorTestCase(unittest.TestCase):
self.failUnlessRaises(TypeError, operator.isNumberType)
self.failUnless(operator.isNumberType(8))
self.failUnless(operator.isNumberType(8j))
- self.failUnless(operator.isNumberType(8L))
+ self.failUnless(operator.isNumberType(8))
self.failUnless(operator.isNumberType(8.3))
self.failIf(operator.isNumberType(dir()))
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index e05fbc6..6ec2902 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -1598,7 +1598,7 @@ class TestParseNumber(BaseTest):
def setUp(self):
self.parser = InterceptingOptionParser()
self.parser.add_option("-n", type=int)
- self.parser.add_option("-l", type=long)
+ self.parser.add_option("-l", type=int)
def test_parse_num_fail(self):
self.assertRaises(
@@ -1606,17 +1606,17 @@ class TestParseNumber(BaseTest):
ValueError,
re.compile(r"invalid literal for int().*: '?'?"))
self.assertRaises(
- _parse_num, ("0xOoops", long), {},
+ _parse_num, ("0xOoops", int), {},
ValueError,
re.compile(r"invalid literal for int().*: '?0xOoops'?"))
def test_parse_num_ok(self):
self.assertEqual(_parse_num("0", int), 0)
self.assertEqual(_parse_num("0x10", int), 16)
- self.assertEqual(_parse_num("0XA", long), 10L)
- self.assertEqual(_parse_num("010", long), 8L)
+ self.assertEqual(_parse_num("0XA", int), 10)
+ self.assertEqual(_parse_num("010", int), 8)
self.assertEqual(_parse_num("0b11", int), 3)
- self.assertEqual(_parse_num("0b", long), 0L)
+ self.assertEqual(_parse_num("0b", int), 0)
def test_numeric_options(self):
self.assertParseOK(["-n", "42", "-l", "0x20"],
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index 60cd3f4..6fbe1b6 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -143,7 +143,7 @@ class PollTests(unittest.TestCase):
pollster = select.poll()
pollster.register(1)
- self.assertRaises(OverflowError, pollster.poll, 1L << 64)
+ self.assertRaises(OverflowError, pollster.poll, 1 << 64)
x = 2 + 3
if x != 5:
diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py
index c6ab218..493aac2 100644
--- a/Lib/test/test_pow.py
+++ b/Lib/test/test_pow.py
@@ -18,14 +18,14 @@ class PowTest(unittest.TestCase):
self.assertEquals(pow(2, i), pow2)
if i != 30 : pow2 = pow2*2
- for othertype in int, long:
+ for othertype in int, int:
for i in range(-10, 0) + range(1, 10):
ii = type(i)
for j in range(1, 11):
jj = -othertype(j)
pow(ii, jj)
- for othertype in int, long, float:
+ for othertype in int, int, float:
for i in range(1, 100):
zero = type(0)
exp = -othertype(i/10.0)
@@ -42,7 +42,7 @@ class PowTest(unittest.TestCase):
asseq = self.assertAlmostEqual
elif type == int:
jl = 0
- elif type == long:
+ elif type == int:
jl, jh = 0, 15
for i in range(il, ih+1):
for j in range(jl, jh+1):
@@ -60,7 +60,7 @@ class PowTest(unittest.TestCase):
self.powtest(int)
def test_powlong(self):
- self.powtest(long)
+ self.powtest(int)
def test_powfloat(self):
self.powtest(float)
@@ -74,12 +74,12 @@ class PowTest(unittest.TestCase):
self.assertEquals(pow(-3,3) % -8, pow(-3,3,-8))
self.assertEquals(pow(5,2) % -8, pow(5,2,-8))
- self.assertEquals(pow(3L,3L) % 8, pow(3L,3L,8))
- self.assertEquals(pow(3L,3L) % -8, pow(3L,3L,-8))
- self.assertEquals(pow(3L,2) % -2, pow(3L,2,-2))
- self.assertEquals(pow(-3L,3L) % 8, pow(-3L,3L,8))
- self.assertEquals(pow(-3L,3L) % -8, pow(-3L,3L,-8))
- self.assertEquals(pow(5L,2) % -8, pow(5L,2,-8))
+ self.assertEquals(pow(3,3) % 8, pow(3,3,8))
+ self.assertEquals(pow(3,3) % -8, pow(3,3,-8))
+ self.assertEquals(pow(3,2) % -2, pow(3,2,-2))
+ self.assertEquals(pow(-3,3) % 8, pow(-3,3,8))
+ self.assertEquals(pow(-3,3) % -8, pow(-3,3,-8))
+ self.assertEquals(pow(5,2) % -8, pow(5,2,-8))
for i in range(-10, 11):
for j in range(0, 6):
@@ -91,8 +91,8 @@ class PowTest(unittest.TestCase):
)
if j >= 0 and k != 0:
self.assertEquals(
- pow(long(i),j) % k,
- pow(long(i),j,k)
+ pow(int(i),j) % k,
+ pow(int(i),j,k)
)
def test_bug643260(self):
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
index 09ba268..8fc8d10 100644
--- a/Lib/test/test_pprint.py
+++ b/Lib/test/test_pprint.py
@@ -114,12 +114,12 @@ class QueryTestCase(unittest.TestCase):
# multiple lines. For that reason, dicts with more than one element
# aren't tested here.
verify = self.assert_
- for simple in (0, 0L, 0+0j, 0.0, "", uni(""),
+ for simple in (0, 0, 0+0j, 0.0, "", uni(""),
(), tuple2(), tuple3(),
[], list2(), list3(),
{}, dict2(), dict3(),
verify, pprint,
- -6, -6L, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6},
+ -6, -6, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6},
(1,2), [3,4], {5: 6, 7: 8},
tuple2((1,2)), tuple3((1,2)), tuple3(range(100)),
[3,4], list2([3,4]), list3([3,4]), list3(range(100)),
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 7ec130d..0e0a273 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -34,7 +34,7 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(randseq, self.randomlist(N))
def test_seedargs(self):
- for arg in [None, 0, 0L, 1, 1L, -1, -1L, 10**20, -(10**20),
+ for arg in [None, 0, 0, 1, 1, -1, -1, 10**20, -(10**20),
3.14, 1+2j, 'a', tuple('abc')]:
self.gen.seed(arg)
for arg in [range(3), dict(one=1)]:
@@ -268,7 +268,7 @@ class SystemRandom_TestBasicOps(TestBasicOps):
# show that: k = int(1.001 + _log(n, 2))
# is equal to or one greater than the number of bits in n
for i in xrange(1, 1000):
- n = 1L << i # check an exact power of two
+ n = 1 << i # check an exact power of two
numbits = i+1
k = int(1.00001 + _log(n, 2))
self.assertEqual(k, numbits)
@@ -327,7 +327,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
0.089215024911993401,
0.78486196105372907]
- self.gen.seed(61731L + (24903L<<32) + (614L<<64) + (42143L<<96))
+ self.gen.seed(61731 + (24903<<32) + (614<<64) + (42143<<96))
actual = self.randomlist(2000)[-10:]
for a, e in zip(actual, expected):
self.assertAlmostEqual(a,e,places=14)
@@ -339,20 +339,20 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
# no rounding errors -- all results are exact).
from math import ldexp
- expected = [0x0eab3258d2231fL,
- 0x1b89db315277a5L,
- 0x1db622a5518016L,
- 0x0b7f9af0d575bfL,
- 0x029e4c4db82240L,
- 0x04961892f5d673L,
- 0x02b291598e4589L,
- 0x11388382c15694L,
- 0x02dad977c9e1feL,
- 0x191d96d4d334c6L]
- self.gen.seed(61731L + (24903L<<32) + (614L<<64) + (42143L<<96))
+ expected = [0x0eab3258d2231f,
+ 0x1b89db315277a5,
+ 0x1db622a5518016,
+ 0x0b7f9af0d575bf,
+ 0x029e4c4db82240,
+ 0x04961892f5d673,
+ 0x02b291598e4589,
+ 0x11388382c15694,
+ 0x02dad977c9e1fe,
+ 0x191d96d4d334c6]
+ self.gen.seed(61731 + (24903<<32) + (614<<64) + (42143<<96))
actual = self.randomlist(2000)[-10:]
for a, e in zip(actual, expected):
- self.assertEqual(long(ldexp(a, 53)), e)
+ self.assertEqual(int(ldexp(a, 53)), e)
def test_long_seed(self):
# This is most interesting to run in debug mode, just to make sure
@@ -360,7 +360,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
# is allocated, consuming space proportional to the number of bits
# in the seed. Unfortunately, that's a quadratic-time algorithm,
# so don't make this horribly big.
- seed = (1L << (10000 * 8)) - 1 # about 10K bytes
+ seed = (1 << (10000 * 8)) - 1 # about 10K bytes
self.gen.seed(seed)
def test_53_bits_per_float(self):
@@ -399,7 +399,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
# Verify cross-platform repeatability
self.gen.seed(1234567)
self.assertEqual(self.gen.getrandbits(100),
- 97904845777343510404718956115L)
+ 97904845777343510404718956115)
# Verify ranges
for k in xrange(1, 1000):
self.assert_(0 <= self.gen.getrandbits(k) < 2**k)
@@ -424,7 +424,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
# show that: k = int(1.001 + _log(n, 2))
# is equal to or one greater than the number of bits in n
for i in xrange(1, 1000):
- n = 1L << i # check an exact power of two
+ n = 1 << i # check an exact power of two
numbits = i+1
k = int(1.00001 + _log(n, 2))
self.assertEqual(k, numbits)
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
index 823298b..1435c6f 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -90,10 +90,10 @@ class ReprTests(unittest.TestCase):
def test_numbers(self):
eq = self.assertEquals
eq(r(123), repr(123))
- eq(r(123L), repr(123L))
+ eq(r(123), repr(123))
eq(r(1.0/3), repr(1.0/3))
- n = 10L**100
+ n = 10**100
expected = repr(n)[:18] + "..." + repr(n)[-19:]
eq(r(n), expected)
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 29ce35b..31aa370 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -45,7 +45,7 @@ finally:
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
# And be sure that setrlimit is checking for really large values
-too_big = 10L**50
+too_big = 10**50
try:
resource.setrlimit(resource.RLIMIT_FSIZE, (too_big, max))
except (OverflowError, ValueError):
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index bd6e621..f22f619 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -86,11 +86,11 @@ class SliceTest(unittest.TestCase):
slice(100, -100, -1).indices(10),
slice(None, None, -1).indices(10)
)
- self.assertEqual(slice(-100L, 100L, 2L).indices(10), (0, 10, 2))
+ self.assertEqual(slice(-100, 100, 2).indices(10), (0, 10, 2))
self.assertEqual(range(10)[::sys.maxint - 1], [0])
- self.assertRaises(OverflowError, slice(None).indices, 1L<<100)
+ self.assertRaises(OverflowError, slice(None).indices, 1<<100)
def test_main():
test_support.run_unittest(SliceTest)
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index ecfb1ed..1f26b4e 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -302,17 +302,17 @@ class GeneralModuleTests(unittest.TestCase):
sizes = {socket.htonl: 32, socket.ntohl: 32,
socket.htons: 16, socket.ntohs: 16}
for func, size in sizes.items():
- mask = (1L<<size) - 1
+ mask = (1<<size) - 1
for i in (0, 1, 0xffff, ~0xffff, 2, 0x01234567, 0x76543210):
self.assertEqual(i & mask, func(func(i&mask)) & mask)
swapped = func(mask)
self.assertEqual(swapped & mask, mask)
- self.assertRaises(OverflowError, func, 1L<<34)
+ self.assertRaises(OverflowError, func, 1<<34)
def testNtoHErrors(self):
- good_values = [ 1, 2, 3, 1L, 2L, 3L ]
- bad_values = [ -1, -2, -3, -1L, -2L, -3L ]
+ good_values = [ 1, 2, 3, 1, 2, 3 ]
+ bad_values = [ -1, -2, -3, -1, -2, -3 ]
for k in good_values:
socket.ntohl(k)
socket.ntohs(k)
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index 00fa227..26bae1b 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -41,7 +41,7 @@ def escapestr(text, ampm):
def strftest(now):
if verbose:
print "strftime test for", time.ctime(now)
- nowsecs = str(long(now))[:-1]
+ nowsecs = str(int(now))[:-1]
gmt = time.gmtime(now)
now = time.localtime(now)
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py
index 6d5e8e4..6e9c122 100644
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -83,7 +83,7 @@ class ModuleTest(unittest.TestCase):
self.assertRaises(ValueError, string.atoi, " x1 ")
def test_atol(self):
- self.assertEqual(string.atol(" 1 "), 1L)
+ self.assertEqual(string.atol(" 1 "), 1)
self.assertRaises(ValueError, string.atol, " 1x ")
self.assertRaises(ValueError, string.atol, " x1 ")
diff --git a/Lib/test/test_strop.py b/Lib/test/test_strop.py
index 2ac7986..66e7eb6 100644
--- a/Lib/test/test_strop.py
+++ b/Lib/test/test_strop.py
@@ -15,7 +15,7 @@ class StropFunctionTestCase(unittest.TestCase):
self.assertRaises(ValueError, strop.atoi, " x1 ")
def test_atol(self):
- self.assert_(strop.atol(" 1 ") == 1L)
+ self.assert_(strop.atol(" 1 ") == 1)
self.assertRaises(ValueError, strop.atol, " 1x")
self.assertRaises(ValueError, strop.atol, " x1 ")
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index d4744dd..f1bef4b 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -146,12 +146,12 @@ tests = [
('H', 0x10000-700, '\375D', 'D\375', 0),
('i', 70000000, '\004,\035\200', '\200\035,\004', 0),
('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0),
- ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0),
- ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0),
+ ('I', 70000000, '\004,\035\200', '\200\035,\004', 0),
+ ('I', 0x100000000-70000000, '\373\323\342\200', '\200\342\323\373', 0),
('l', 70000000, '\004,\035\200', '\200\035,\004', 0),
('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0),
- ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0),
- ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0),
+ ('L', 70000000, '\004,\035\200', '\200\035,\004', 0),
+ ('L', 0x100000000-70000000, '\373\323\342\200', '\200\342\323\373', 0),
('f', 2.0, '@\000\000\000', '\000\000\000@', 0),
('d', 2.0, '@\000\000\000\000\000\000\000',
'\000\000\000\000\000\000\000@', 0),
@@ -203,9 +203,9 @@ def test_native_qQ():
('q', -1, '\xff' * bytes),
('q', 0, '\x00' * bytes),
('Q', 0, '\x00' * bytes),
- ('q', 1L, '\x00' * (bytes-1) + '\x01'),
- ('Q', (1L << (8*bytes))-1, '\xff' * bytes),
- ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))):
+ ('q', 1, '\x00' * (bytes-1) + '\x01'),
+ ('Q', (1 << (8*bytes))-1, '\xff' * bytes),
+ ('q', (1 << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))):
got = struct.pack(format, input)
native_expected = bigendian_to_native(expected)
verify(got == native_expected,
@@ -243,9 +243,9 @@ class IntTester:
self.bitsize = bytesize * 8
self.signed_code, self.unsigned_code = formatpair
self.unsigned_min = 0
- self.unsigned_max = 2L**self.bitsize - 1
- self.signed_min = -(2L**(self.bitsize-1))
- self.signed_max = 2L**(self.bitsize-1) - 1
+ self.unsigned_max = 2**self.bitsize - 1
+ self.signed_min = -(2**(self.bitsize-1))
+ self.signed_max = 2**(self.bitsize-1) - 1
def test_one(self, x, pack=struct.pack,
unpack=struct.unpack,
@@ -257,9 +257,9 @@ class IntTester:
code = self.signed_code
if self.signed_min <= x <= self.signed_max:
# Try big-endian.
- expected = long(x)
+ expected = int(x)
if x < 0:
- expected += 1L << self.bitsize
+ expected += 1 << self.bitsize
assert expected > 0
expected = hex(expected)[2:] # chop "0x"
if len(expected) & 1:
@@ -316,7 +316,7 @@ class IntTester:
if self.unsigned_min <= x <= self.unsigned_max:
# Try big-endian.
format = ">" + code
- expected = long(x)
+ expected = int(x)
expected = hex(expected)[2:] # chop "0x"
if len(expected) & 1:
expected = "0" + expected
@@ -372,11 +372,11 @@ class IntTester:
# Create all interesting powers of 2.
values = []
for exp in range(self.bitsize + 3):
- values.append(1L << exp)
+ values.append(1 << exp)
# Add some random values.
for i in range(self.bitsize):
- val = 0L
+ val = 0
for j in range(self.bytesize):
val = (val << 8) | randrange(256)
values.append(val)
@@ -485,15 +485,15 @@ test_705836()
def test_1229380():
import sys
for endian in ('', '>', '<'):
- for cls in (int, long):
+ for cls in (int, int):
for fmt in ('B', 'H', 'I', 'L'):
deprecated_err(struct.pack, endian + fmt, cls(-1))
deprecated_err(struct.pack, endian + 'B', cls(300))
deprecated_err(struct.pack, endian + 'H', cls(70000))
- deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L)
- deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L)
+ deprecated_err(struct.pack, endian + 'I', sys.maxint * 4)
+ deprecated_err(struct.pack, endian + 'L', sys.maxint * 4)
if PY_STRUCT_RANGE_CHECKING:
test_1229380()
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 18129da..3a7fa0f 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -20,8 +20,8 @@ class TimeTestCase(unittest.TestCase):
def test_conversions(self):
self.assert_(time.ctime(self.t)
== time.asctime(time.localtime(self.t)))
- self.assert_(long(time.mktime(time.localtime(self.t)))
- == long(self.t))
+ self.assert_(int(time.mktime(time.localtime(self.t)))
+ == int(self.t))
def test_sleep(self):
time.sleep(1.2)
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index 2b32b92..94765d9 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -46,7 +46,7 @@ class CreationTestCase(unittest.TestCase):
def testTypeCheck(self):
# Test type checking by settimeout()
self.sock.settimeout(0)
- self.sock.settimeout(0L)
+ self.sock.settimeout(0)
self.sock.settimeout(0.0)
self.sock.settimeout(None)
self.assertRaises(TypeError, self.sock.settimeout, "")
@@ -59,7 +59,7 @@ class CreationTestCase(unittest.TestCase):
def testRangeCheck(self):
# Test range checking by settimeout()
self.assertRaises(ValueError, self.sock.settimeout, -1)
- self.assertRaises(ValueError, self.sock.settimeout, -1L)
+ self.assertRaises(ValueError, self.sock.settimeout, -1)
self.assertRaises(ValueError, self.sock.settimeout, -1.0)
def testTimeoutThenBlocking(self):
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 8d26914..f5970ba 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -9,11 +9,11 @@ class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is true instead of false')
if 0: self.fail('0 is true instead of false')
- if 0L: self.fail('0L is true instead of false')
+ if 0: self.fail('0L is true instead of false')
if 0.0: self.fail('0.0 is true instead of false')
if '': self.fail('\'\' is true instead of false')
if not 1: self.fail('1 is false instead of true')
- if not 1L: self.fail('1L is false instead of true')
+ if not 1: self.fail('1L is false instead of true')
if not 1.0: self.fail('1.0 is false instead of true')
if not 'x': self.fail('\'x\' is false instead of true')
if not {'x': 1}: self.fail('{\'x\': 1} is false instead of true')
@@ -35,7 +35,7 @@ class TypesTests(unittest.TestCase):
def test_comparisons(self):
if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass
else: self.fail('int comparisons failed')
- if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass
+ if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass
else: self.fail('long int comparisons failed')
if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass
else: self.fail('float comparisons failed')
@@ -61,30 +61,30 @@ class TypesTests(unittest.TestCase):
except ZeroDivisionError: pass
else: self.fail("5.0 % 0.0 didn't raise ZeroDivisionError")
- try: 5 / 0L
+ try: 5 / 0
except ZeroDivisionError: pass
else: self.fail("5 / 0L didn't raise ZeroDivisionError")
- try: 5 // 0L
+ try: 5 // 0
except ZeroDivisionError: pass
else: self.fail("5 // 0L didn't raise ZeroDivisionError")
- try: 5 % 0L
+ try: 5 % 0
except ZeroDivisionError: pass
else: self.fail("5 % 0L didn't raise ZeroDivisionError")
def test_numeric_types(self):
- if 0 != 0L or 0 != 0.0 or 0L != 0.0: self.fail('mixed comparisons')
- if 1 != 1L or 1 != 1.0 or 1L != 1.0: self.fail('mixed comparisons')
- if -1 != -1L or -1 != -1.0 or -1L != -1.0:
+ if 0 != 0 or 0 != 0.0 or 0 != 0.0: self.fail('mixed comparisons')
+ if 1 != 1 or 1 != 1.0 or 1 != 1.0: self.fail('mixed comparisons')
+ if -1 != -1 or -1 != -1.0 or -1 != -1.0:
self.fail('int/long/float value not equal')
# calling built-in types without argument must return 0
if int() != 0: self.fail('int() does not return 0')
- if long() != 0L: self.fail('long() does not return 0L')
+ if int() != 0: self.fail('long() does not return 0L')
if float() != 0.0: self.fail('float() does not return 0.0')
if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass
else: self.fail('int() does not round properly')
- if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass
+ if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass
else: self.fail('long() does not round properly')
if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass
else: self.fail('float() does not work properly')
@@ -118,7 +118,7 @@ class TypesTests(unittest.TestCase):
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor - 1
prod = divisor * j
- if type(prod) is not long:
+ if type(prod) is not int:
self.fail("expected type(%r) to be long, not %r" %
(prod, type(prod)))
# Check for expected * overflow to long.
@@ -126,35 +126,35 @@ class TypesTests(unittest.TestCase):
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor + 1
prod = divisor * j
- if type(prod) is not long:
+ if type(prod) is not int:
self.fail("expected type(%r) to be long, not %r" %
(prod, type(prod)))
def test_long_integers(self):
- if 12L + 24L != 36L: self.fail('long op')
- if 12L + (-24L) != -12L: self.fail('long op')
- if (-12L) + 24L != 12L: self.fail('long op')
- if (-12L) + (-24L) != -36L: self.fail('long op')
- if not 12L < 24L: self.fail('long op')
- if not -24L < -12L: self.fail('long op')
+ if 12 + 24 != 36: self.fail('long op')
+ if 12 + (-24) != -12: self.fail('long op')
+ if (-12) + 24 != 12: self.fail('long op')
+ 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
- if int(long(x)) != x: self.fail('long op')
- try: y = int(long(x)+1L)
+ if int(int(x)) != x: self.fail('long op')
+ try: y = int(int(x)+1)
except OverflowError: self.fail('long op')
- if not isinstance(y, long): self.fail('long op')
+ if not isinstance(y, int): self.fail('long op')
x = -x
- if int(long(x)) != x: self.fail('long op')
+ if int(int(x)) != x: self.fail('long op')
x = x-1
- if int(long(x)) != x: self.fail('long op')
- try: y = int(long(x)-1L)
+ if int(int(x)) != x: self.fail('long op')
+ try: y = int(int(x)-1)
except OverflowError: self.fail('long op')
- if not isinstance(y, long): self.fail('long op')
+ if not isinstance(y, int): self.fail('long op')
try: 5 << -5
except ValueError: pass
else: self.fail('int negative shift <<')
- try: 5L << -5L
+ try: 5 << -5
except ValueError: pass
else: self.fail('long negative shift <<')
@@ -162,7 +162,7 @@ class TypesTests(unittest.TestCase):
except ValueError: pass
else: self.fail('int negative shift >>')
- try: 5L >> -5L
+ try: 5 >> -5
except ValueError: pass
else: self.fail('long negative shift >>')
@@ -197,7 +197,7 @@ class TypesTests(unittest.TestCase):
self.assertEqual(a[3::-2], '31')
self.assertEqual(a[-100:100:], a)
self.assertEqual(a[100:-100:-1], a[::-1])
- self.assertEqual(a[-100L:100L:2L], '02468')
+ self.assertEqual(a[-100:100:2], '02468')
if have_unicode:
a = unicode('0123456789', 'ascii')
@@ -209,7 +209,7 @@ class TypesTests(unittest.TestCase):
self.assertEqual(a[3::-2], unicode('31', 'ascii'))
self.assertEqual(a[-100:100:], a)
self.assertEqual(a[100:-100:-1], a[::-1])
- self.assertEqual(a[-100L:100L:2L], unicode('02468', 'ascii'))
+ self.assertEqual(a[-100:100:2], unicode('02468', 'ascii'))
def test_type_function(self):
diff --git a/Lib/test/test_unary.py b/Lib/test/test_unary.py
index 9854f64..1e07c15 100644
--- a/Lib/test/test_unary.py
+++ b/Lib/test/test_unary.py
@@ -9,7 +9,7 @@ class UnaryOpTestCase(unittest.TestCase):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
self.assert_(--2 == 2)
- self.assert_(-2L == 0 - 2L)
+ self.assert_(-2 == 0 - 2)
self.assert_(-2.0 == 0 - 2.0)
self.assert_(-2j == 0 - 2j)
@@ -17,7 +17,7 @@ class UnaryOpTestCase(unittest.TestCase):
self.assert_(+2 == 2)
self.assert_(+0 == 0)
self.assert_(++2 == 2)
- self.assert_(+2L == 2L)
+ self.assert_(+2 == 2)
self.assert_(+2.0 == 2.0)
self.assert_(+2j == 2j)
@@ -25,13 +25,13 @@ class UnaryOpTestCase(unittest.TestCase):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
self.assert_(--2 == 2)
- self.assert_(-2L == 0 - 2L)
+ self.assert_(-2 == 0 - 2)
def test_no_overflow(self):
nines = "9" * 32
- self.assert_(eval("+" + nines) == eval("+" + nines + "L"))
- self.assert_(eval("-" + nines) == eval("-" + nines + "L"))
- self.assert_(eval("~" + nines) == eval("~" + nines + "L"))
+ self.assert_(eval("+" + nines) == 10**32-1)
+ self.assert_(eval("-" + nines) == -(10**32-1))
+ self.assert_(eval("~" + nines) == ~(10**32-1))
def test_negation_of_exponentiation(self):
# Make sure '**' does the right thing; these form a
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 38ff9ac..5c70df1 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -483,7 +483,7 @@ class UnicodeTest(
UnicodeCompat(u"u'%s' % obj falls back to obj.__str__()"),
u"u'%s' % obj falls back to obj.__str__()")
- for obj in (123, 123.45, 123L):
+ for obj in (123, 123.45, 123):
self.assertEqual(unicode(obj), unicode(str(obj)))
# unicode(obj, encoding, error) tests (this maps to
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
index 90671be..f1d1d1c 100644
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -32,19 +32,19 @@ class TestUUID(TestCase):
'000102030405060708090a0b0c0d0e0f',
'\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f',
'\x03\x02\x01\0\x05\x04\x07\x06\x08\t\n\x0b\x0c\x0d\x0e\x0f',
- (0x00010203L, 0x0405, 0x0607, 8, 9, 0x0a0b0c0d0e0fL),
- 0x000102030405060708090a0b0c0d0e0fL,
+ (0x00010203, 0x0405, 0x0607, 8, 9, 0x0a0b0c0d0e0f),
+ 0x000102030405060708090a0b0c0d0e0f,
'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f',
- 0x607040500010203L, 0x809, uuid.RESERVED_NCS, None),
+ 0x607040500010203, 0x809, uuid.RESERVED_NCS, None),
('02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
'{02d9e6d5-9467-382e-8f9b-9300a64ac3cd}',
'02d9e6d59467382e8f9b9300a64ac3cd',
'\x02\xd9\xe6\xd5\x94\x67\x38\x2e\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd',
'\xd5\xe6\xd9\x02\x67\x94\x2e\x38\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd',
- (0x02d9e6d5L, 0x9467, 0x382e, 0x8f, 0x9b, 0x9300a64ac3cdL),
- 0x02d9e6d59467382e8f9b9300a64ac3cdL,
+ (0x02d9e6d5, 0x9467, 0x382e, 0x8f, 0x9b, 0x9300a64ac3cd),
+ 0x02d9e6d59467382e8f9b9300a64ac3cd,
'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
- 0x82e946702d9e6d5L, 0xf9b, uuid.RFC_4122, 3),
+ 0x82e946702d9e6d5, 0xf9b, uuid.RFC_4122, 3),
('12345678-1234-5678-1234-567812345678',
'{12345678-1234-5678-1234-567812345678}',
'12345678123456781234567812345678',
@@ -53,97 +53,97 @@ class TestUUID(TestCase):
(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678),
0x12345678123456781234567812345678,
'urn:uuid:12345678-1234-5678-1234-567812345678',
- 0x678123412345678L, 0x1234, uuid.RESERVED_NCS, None),
+ 0x678123412345678, 0x1234, uuid.RESERVED_NCS, None),
('6ba7b810-9dad-11d1-80b4-00c04fd430c8',
'{6ba7b810-9dad-11d1-80b4-00c04fd430c8}',
'6ba7b8109dad11d180b400c04fd430c8',
'\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
'\x10\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
- (0x6ba7b810L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
- 0x6ba7b8109dad11d180b400c04fd430c8L,
+ (0x6ba7b810, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8),
+ 0x6ba7b8109dad11d180b400c04fd430c8,
'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8',
- 0x1d19dad6ba7b810L, 0xb4, uuid.RFC_4122, 1),
+ 0x1d19dad6ba7b810, 0xb4, uuid.RFC_4122, 1),
('6ba7b811-9dad-11d1-80b4-00c04fd430c8',
'{6ba7b811-9dad-11d1-80b4-00c04fd430c8}',
'6ba7b8119dad11d180b400c04fd430c8',
'\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
'\x11\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
- (0x6ba7b811L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
- 0x6ba7b8119dad11d180b400c04fd430c8L,
+ (0x6ba7b811, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8),
+ 0x6ba7b8119dad11d180b400c04fd430c8,
'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8',
- 0x1d19dad6ba7b811L, 0xb4, uuid.RFC_4122, 1),
+ 0x1d19dad6ba7b811, 0xb4, uuid.RFC_4122, 1),
('6ba7b812-9dad-11d1-80b4-00c04fd430c8',
'{6ba7b812-9dad-11d1-80b4-00c04fd430c8}',
'6ba7b8129dad11d180b400c04fd430c8',
'\x6b\xa7\xb8\x12\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
'\x12\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
- (0x6ba7b812L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
- 0x6ba7b8129dad11d180b400c04fd430c8L,
+ (0x6ba7b812, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8),
+ 0x6ba7b8129dad11d180b400c04fd430c8,
'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8',
- 0x1d19dad6ba7b812L, 0xb4, uuid.RFC_4122, 1),
+ 0x1d19dad6ba7b812, 0xb4, uuid.RFC_4122, 1),
('6ba7b814-9dad-11d1-80b4-00c04fd430c8',
'{6ba7b814-9dad-11d1-80b4-00c04fd430c8}',
'6ba7b8149dad11d180b400c04fd430c8',
'\x6b\xa7\xb8\x14\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
'\x14\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
- (0x6ba7b814L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
- 0x6ba7b8149dad11d180b400c04fd430c8L,
+ (0x6ba7b814, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8),
+ 0x6ba7b8149dad11d180b400c04fd430c8,
'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8',
- 0x1d19dad6ba7b814L, 0xb4, uuid.RFC_4122, 1),
+ 0x1d19dad6ba7b814, 0xb4, uuid.RFC_4122, 1),
('7d444840-9dc0-11d1-b245-5ffdce74fad2',
'{7d444840-9dc0-11d1-b245-5ffdce74fad2}',
'7d4448409dc011d1b2455ffdce74fad2',
'\x7d\x44\x48\x40\x9d\xc0\x11\xd1\xb2\x45\x5f\xfd\xce\x74\xfa\xd2',
'\x40\x48\x44\x7d\xc0\x9d\xd1\x11\xb2\x45\x5f\xfd\xce\x74\xfa\xd2',
- (0x7d444840L, 0x9dc0, 0x11d1, 0xb2, 0x45, 0x5ffdce74fad2L),
- 0x7d4448409dc011d1b2455ffdce74fad2L,
+ (0x7d444840, 0x9dc0, 0x11d1, 0xb2, 0x45, 0x5ffdce74fad2),
+ 0x7d4448409dc011d1b2455ffdce74fad2,
'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2',
- 0x1d19dc07d444840L, 0x3245, uuid.RFC_4122, 1),
+ 0x1d19dc07d444840, 0x3245, uuid.RFC_4122, 1),
('e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
'{e902893a-9d22-3c7e-a7b8-d6e313b71d9f}',
'e902893a9d223c7ea7b8d6e313b71d9f',
'\xe9\x02\x89\x3a\x9d\x22\x3c\x7e\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f',
'\x3a\x89\x02\xe9\x22\x9d\x7e\x3c\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f',
- (0xe902893aL, 0x9d22, 0x3c7e, 0xa7, 0xb8, 0xd6e313b71d9fL),
- 0xe902893a9d223c7ea7b8d6e313b71d9fL,
+ (0xe902893a, 0x9d22, 0x3c7e, 0xa7, 0xb8, 0xd6e313b71d9f),
+ 0xe902893a9d223c7ea7b8d6e313b71d9f,
'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
- 0xc7e9d22e902893aL, 0x27b8, uuid.RFC_4122, 3),
+ 0xc7e9d22e902893a, 0x27b8, uuid.RFC_4122, 3),
('eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
'{eb424026-6f54-4ef8-a4d0-bb658a1fc6cf}',
'eb4240266f544ef8a4d0bb658a1fc6cf',
'\xeb\x42\x40\x26\x6f\x54\x4e\xf8\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf',
'\x26\x40\x42\xeb\x54\x6f\xf8\x4e\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf',
- (0xeb424026L, 0x6f54, 0x4ef8, 0xa4, 0xd0, 0xbb658a1fc6cfL),
- 0xeb4240266f544ef8a4d0bb658a1fc6cfL,
+ (0xeb424026, 0x6f54, 0x4ef8, 0xa4, 0xd0, 0xbb658a1fc6cf),
+ 0xeb4240266f544ef8a4d0bb658a1fc6cf,
'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
- 0xef86f54eb424026L, 0x24d0, uuid.RFC_4122, 4),
+ 0xef86f54eb424026, 0x24d0, uuid.RFC_4122, 4),
('f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
'{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}',
'f81d4fae7dec11d0a76500a0c91e6bf6',
'\xf8\x1d\x4f\xae\x7d\xec\x11\xd0\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6',
'\xae\x4f\x1d\xf8\xec\x7d\xd0\x11\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6',
- (0xf81d4faeL, 0x7dec, 0x11d0, 0xa7, 0x65, 0x00a0c91e6bf6L),
- 0xf81d4fae7dec11d0a76500a0c91e6bf6L,
+ (0xf81d4fae, 0x7dec, 0x11d0, 0xa7, 0x65, 0x00a0c91e6bf6),
+ 0xf81d4fae7dec11d0a76500a0c91e6bf6,
'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
- 0x1d07decf81d4faeL, 0x2765, uuid.RFC_4122, 1),
+ 0x1d07decf81d4fae, 0x2765, uuid.RFC_4122, 1),
('fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
'{fffefdfc-fffe-fffe-fffe-fffefdfcfbfa}',
'fffefdfcfffefffefffefffefdfcfbfa',
'\xff\xfe\xfd\xfc\xff\xfe\xff\xfe\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa',
'\xfc\xfd\xfe\xff\xfe\xff\xfe\xff\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa',
- (0xfffefdfcL, 0xfffe, 0xfffe, 0xff, 0xfe, 0xfffefdfcfbfaL),
- 0xfffefdfcfffefffefffefffefdfcfbfaL,
+ (0xfffefdfc, 0xfffe, 0xfffe, 0xff, 0xfe, 0xfffefdfcfbfa),
+ 0xfffefdfcfffefffefffefffefdfcfbfa,
'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
- 0xffefffefffefdfcL, 0x3ffe, uuid.RESERVED_FUTURE, None),
+ 0xffefffefffefdfc, 0x3ffe, uuid.RESERVED_FUTURE, None),
('ffffffff-ffff-ffff-ffff-ffffffffffff',
'{ffffffff-ffff-ffff-ffff-ffffffffffff}',
'ffffffffffffffffffffffffffffffff',
'\xff'*16,
'\xff'*16,
- (0xffffffffL, 0xffffL, 0xffffL, 0xff, 0xff, 0xffffffffffffL),
- 0xffffffffffffffffffffffffffffffffL,
+ (0xffffffff, 0xffff, 0xffff, 0xff, 0xff, 0xffffffffffff),
+ 0xffffffffffffffffffffffffffffffff,
'urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff',
- 0xfffffffffffffffL, 0x3fff, uuid.RESERVED_FUTURE, None),
+ 0xfffffffffffffff, 0x3fff, uuid.RESERVED_FUTURE, None),
]:
equivalents = []
# Construct each UUID in several different ways.
@@ -217,17 +217,17 @@ class TestUUID(TestCase):
# Field values out of range.
badvalue(lambda: uuid.UUID(fields=(-1, 0, 0, 0, 0, 0)))
- badvalue(lambda: uuid.UUID(fields=(0x100000000L, 0, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0x100000000, 0, 0, 0, 0, 0)))
badvalue(lambda: uuid.UUID(fields=(0, -1, 0, 0, 0, 0)))
- badvalue(lambda: uuid.UUID(fields=(0, 0x10000L, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0x10000, 0, 0, 0, 0)))
badvalue(lambda: uuid.UUID(fields=(0, 0, -1, 0, 0, 0)))
- badvalue(lambda: uuid.UUID(fields=(0, 0, 0x10000L, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0x10000, 0, 0, 0)))
badvalue(lambda: uuid.UUID(fields=(0, 0, 0, -1, 0, 0)))
- badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0x100L, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0x100, 0, 0)))
badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, -1, 0)))
- badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0x100L, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0x100, 0)))
badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, -1)))
- badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000L)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000)))
# Version number out of range.
badvalue(lambda: uuid.UUID('00'*16, version=0))
@@ -235,7 +235,7 @@ class TestUUID(TestCase):
# Integer value out of range.
badvalue(lambda: uuid.UUID(int=-1))
- badvalue(lambda: uuid.UUID(int=1<<128L))
+ badvalue(lambda: uuid.UUID(int=1<<128))
# Must supply exactly one of hex, bytes, fields, int.
h, b, f, i = '00'*16, '\0'*16, (0, 0, 0, 0, 0, 0), 0
@@ -281,15 +281,15 @@ class TestUUID(TestCase):
badtype(lambda: setattr(u, 'node', 0))
def check_node(self, node, source):
- individual_group_bit = (node >> 40L) & 1
- universal_local_bit = (node >> 40L) & 2
+ individual_group_bit = (node >> 40) & 1
+ universal_local_bit = (node >> 40) & 2
message = "%012x doesn't look like a real MAC address" % node
self.assertEqual(individual_group_bit, 0, message)
self.assertEqual(universal_local_bit, 0, message)
self.assertNotEqual(node, 0, message)
- self.assertNotEqual(node, 0xffffffffffffL, message)
+ self.assertNotEqual(node, 0xffffffffffff, message)
self.assert_(0 <= node, message)
- self.assert_(node < (1L << 48), message)
+ self.assert_(node < (1 << 48), message)
TestUUID.source2node[source] = node
if TestUUID.last_node:
@@ -332,7 +332,7 @@ class TestUUID(TestCase):
def test_random_getnode(self):
node = uuid._random_getnode()
self.assert_(0 <= node)
- self.assert_(node < (1L <<48))
+ self.assert_(node < (1 <<48))
def test_unixdll_getnode(self):
import sys
diff --git a/Lib/test/test_xdrlib.py b/Lib/test/test_xdrlib.py
index 8fc88a5..97f0cc9 100644
--- a/Lib/test/test_xdrlib.py
+++ b/Lib/test/test_xdrlib.py
@@ -15,7 +15,7 @@ class XDRTest(unittest.TestCase):
p.pack_uint(9)
p.pack_bool(True)
p.pack_bool(False)
- p.pack_uhyper(45L)
+ p.pack_uhyper(45)
p.pack_float(1.9)
p.pack_double(1.9)
p.pack_string(s)
@@ -40,7 +40,7 @@ class XDRTest(unittest.TestCase):
up.set_position(pos)
self.assert_(up.unpack_bool() is False)
- self.assertEqual(up.unpack_uhyper(), 45L)
+ self.assertEqual(up.unpack_uhyper(), 45)
self.assertAlmostEqual(up.unpack_float(), 1.9)
self.assertAlmostEqual(up.unpack_double(), 1.9)
self.assertEqual(up.unpack_string(), s)
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index ccc1b60..795e097 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -14,7 +14,7 @@ else:
alist = [{'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,
'anint': 2**20,
- 'ashortlong': 2L,
+ 'ashortlong': 2,
'anotherlist': ['.zyx.41'],
'abase64': xmlrpclib.Binary("my dog has fleas"),
'boolean': xmlrpclib.False,
@@ -96,15 +96,15 @@ class XMLRPCTestCase(unittest.TestCase):
self.assertEquals(t2, t.__dict__)
def test_dump_big_long(self):
- self.assertRaises(OverflowError, xmlrpclib.dumps, (2L**99,))
+ self.assertRaises(OverflowError, xmlrpclib.dumps, (2**99,))
def test_dump_bad_dict(self):
self.assertRaises(TypeError, xmlrpclib.dumps, ({(1,2,3): 1},))
def test_dump_big_int(self):
- if sys.maxint > 2L**31-1:
+ if sys.maxint > 2**31-1:
self.assertRaises(OverflowError, xmlrpclib.dumps,
- (int(2L**34),))
+ (int(2**34),))
def test_dump_none(self):
value = alist + [None]
diff --git a/Lib/test/test_xrange.py b/Lib/test/test_xrange.py
index c0d1dbe..5225250 100644
--- a/Lib/test/test_xrange.py
+++ b/Lib/test/test_xrange.py
@@ -21,7 +21,7 @@ class XrangeTest(unittest.TestCase):
c = 50
self.assertEqual(list(xrange(a, a+2)), [a, a+1])
- self.assertEqual(list(xrange(a+2, a, -1L)), [a+2, a+1])
+ self.assertEqual(list(xrange(a+2, a, -1)), [a+2, a+1])
self.assertEqual(list(xrange(a+4, a, -2)), [a+4, a+2])
seq = list(xrange(a, b, c))
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index 4e1a845..53c5504 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -31,7 +31,7 @@ def make_pyc(co, mtime):
if mtime < 0x7fffffff:
mtime = int(mtime)
else:
- mtime = int(-0x100000000L + long(mtime))
+ mtime = int(-0x100000000 + int(mtime))
pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data
return pyc
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 4440942..0be9668 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -43,10 +43,10 @@ class ChecksumTestCase(unittest.TestCase):
def assertEqual32(self, seen, expected):
# 32-bit values masked -- checksums on 32- vs 64- bit machines
# This is important if bit 31 (0x08000000L) is set.
- self.assertEqual(seen & 0x0FFFFFFFFL, expected & 0x0FFFFFFFFL)
+ self.assertEqual(seen & 0x0FFFFFFFF, expected & 0x0FFFFFFFF)
def test_penguins(self):
- self.assertEqual32(zlib.crc32("penguin", 0), 0x0e5c1a120L)
+ self.assertEqual32(zlib.crc32("penguin", 0), 0x0e5c1a120)
self.assertEqual32(zlib.crc32("penguin", 1), 0x43b6aa94)
self.assertEqual32(zlib.adler32("penguin", 0), 0x0bcf02f6)
self.assertEqual32(zlib.adler32("penguin", 1), 0x0bd602f7)