Rip out 'long' and 'L'-suffixed integer literals.
(Rough first cut.)
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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):