mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Rip out 'long' and 'L'-suffixed integer literals.
(Rough first cut.)
This commit is contained in:
parent
fc7bb8c786
commit
e2a383d062
146 changed files with 1446 additions and 1477 deletions
|
@ -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")
|
||||
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 = 123456789012345678901234567890L
|
||||
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", 1, "0x1")
|
||||
testboth("%#x", 1L, "0x1")
|
||||
testboth("%#X", 1, "0X1")
|
||||
testboth("%#X", 1L, "0X1")
|
||||
testboth("%#X", 1, "0X1")
|
||||
testboth("%#o", 1, "01")
|
||||
testboth("%#o", 1, "01")
|
||||
testboth("%#o", 1L, "01")
|
||||
testboth("%#o", 0, "0")
|
||||
testboth("%#o", 0L, "0")
|
||||
testboth("%#o", 0, "0")
|
||||
testboth("%o", 0, "0")
|
||||
testboth("%o", 0, "0")
|
||||
testboth("%o", 0L, "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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue