diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-03-16 05:05:12 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-03-16 05:05:12 (GMT) |
commit | 0c1f7c0c8adacac5f2960357b1c35f23352b4e70 (patch) | |
tree | 088c721950db8f2e99d25edecfd058941c3af753 /Lib/test/test_tokenize.py | |
parent | fc689ddc0d1eb7468dd2dfea71689af1ce05fe46 (diff) | |
download | cpython-0c1f7c0c8adacac5f2960357b1c35f23352b4e70.zip cpython-0c1f7c0c8adacac5f2960357b1c35f23352b4e70.tar.gz cpython-0c1f7c0c8adacac5f2960357b1c35f23352b4e70.tar.bz2 |
Fix doctests in test_tokenize by converting Python 2.x syntax
to Python 3.0 syntax (drop leading '0' and trailing 'L' from
integer literals, remove leading 'u' from unicode string
literals), and adjusting expected output accordingly.
Diffstat (limited to 'Lib/test/test_tokenize.py')
-rw-r--r-- | Lib/test/test_tokenize.py | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 2ed723b..9165003 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -125,16 +125,16 @@ Ordinary integers and binary operators NUMBER '0xff' (1, 0) (1, 4) OP '<=' (1, 5) (1, 7) NUMBER '255' (1, 8) (1, 11) - >>> dump_tokens("01234567 > ~0x15") - NUMBER '01234567' (1, 0) (1, 8) - OP '>' (1, 9) (1, 10) - OP '~' (1, 11) (1, 12) - NUMBER '0x15' (1, 12) (1, 16) - >>> dump_tokens("2134568 != 01231515") + >>> dump_tokens("1234567 > ~0x15") + NUMBER '1234567' (1, 0) (1, 7) + OP '>' (1, 8) (1, 9) + OP '~' (1, 10) (1, 11) + NUMBER '0x15' (1, 11) (1, 15) + >>> dump_tokens("2134568 != 1231515") NUMBER '2134568' (1, 0) (1, 7) OP '!=' (1, 8) (1, 10) - NUMBER '01231515' (1, 11) (1, 19) - >>> dump_tokens("(-124561-1) & 0200000000") + NUMBER '1231515' (1, 11) (1, 18) + >>> dump_tokens("(-124561-1) & 200000000") OP '(' (1, 0) (1, 1) OP '-' (1, 1) (1, 2) NUMBER '124561' (1, 2) (1, 8) @@ -142,16 +142,16 @@ Ordinary integers and binary operators NUMBER '1' (1, 9) (1, 10) OP ')' (1, 10) (1, 11) OP '&' (1, 12) (1, 13) - NUMBER '0200000000' (1, 14) (1, 24) + NUMBER '200000000' (1, 14) (1, 23) >>> dump_tokens("0xdeadbeef != -1") NUMBER '0xdeadbeef' (1, 0) (1, 10) OP '!=' (1, 11) (1, 13) OP '-' (1, 14) (1, 15) NUMBER '1' (1, 15) (1, 16) - >>> dump_tokens("0xdeadc0de & 012345") + >>> dump_tokens("0xdeadc0de & 12345") NUMBER '0xdeadc0de' (1, 0) (1, 10) OP '&' (1, 11) (1, 12) - NUMBER '012345' (1, 13) (1, 19) + NUMBER '12345' (1, 13) (1, 18) >>> dump_tokens("0xFF & 0x15 | 1234") NUMBER '0xFF' (1, 0) (1, 4) OP '&' (1, 5) (1, 6) @@ -161,23 +161,23 @@ Ordinary integers and binary operators Long integers - >>> dump_tokens("x = 0L") + >>> dump_tokens("x = 0") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - NUMBER '0L' (1, 4) (1, 6) + NUMBER '0' (1, 4) (1, 5) >>> dump_tokens("x = 0xfffffffffff") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '0xffffffffff (1, 4) (1, 17) - >>> dump_tokens("x = 123141242151251616110l") + >>> dump_tokens("x = 123141242151251616110") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - NUMBER '123141242151 (1, 4) (1, 26) - >>> dump_tokens("x = -15921590215012591L") + NUMBER '123141242151 (1, 4) (1, 25) + >>> dump_tokens("x = -15921590215012591") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) OP '-' (1, 4) (1, 5) - NUMBER '159215902150 (1, 5) (1, 23) + NUMBER '159215902150 (1, 5) (1, 22) Floating point numbers @@ -236,38 +236,38 @@ String literals STRING '"doesn\\'t "' (1, 4) (1, 14) NAME 'shrink' (1, 14) (1, 20) STRING '", does it"' (1, 20) (1, 31) - >>> dump_tokens("x = u'abc' + U'ABC'") + >>> dump_tokens("x = 'abc' + 'ABC'") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - STRING "u'abc'" (1, 4) (1, 10) - OP '+' (1, 11) (1, 12) - STRING "U'ABC'" (1, 13) (1, 19) + STRING "'abc'" (1, 4) (1, 9) + OP '+' (1, 10) (1, 11) + STRING "'ABC'" (1, 12) (1, 17) >>> dump_tokens('y = "ABC" + "ABC"') NAME 'y' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - STRING '"ABC"' (1, 4) (1, 10) - OP '+' (1, 11) (1, 12) - STRING '"ABC"' (1, 13) (1, 19) + STRING '"ABC"' (1, 4) (1, 9) + OP '+' (1, 10) (1, 11) + STRING '"ABC"' (1, 12) (1, 17) >>> dump_tokens("x = r'abc' + r'ABC' + R'ABC' + R'ABC'") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - STRING "r'abc'" (1, 4) (1, 11) - OP '+' (1, 12) (1, 13) - STRING "r'ABC'" (1, 14) (1, 21) - OP '+' (1, 22) (1, 23) - STRING "R'ABC'" (1, 24) (1, 31) - OP '+' (1, 32) (1, 33) - STRING "R'ABC'" (1, 34) (1, 41) + STRING "r'abc'" (1, 4) (1, 10) + OP '+' (1, 11) (1, 12) + STRING "r'ABC'" (1, 13) (1, 19) + OP '+' (1, 20) (1, 21) + STRING "R'ABC'" (1, 22) (1, 28) + OP '+' (1, 29) (1, 30) + STRING "R'ABC'" (1, 31) (1, 37) >>> dump_tokens('y = r"abc" + r"ABC" + R"ABC" + R"ABC"') NAME 'y' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) - STRING 'r"abc"' (1, 4) (1, 11) - OP '+' (1, 12) (1, 13) - STRING 'r"ABC"' (1, 14) (1, 21) - OP '+' (1, 22) (1, 23) - STRING 'R"ABC"' (1, 24) (1, 31) - OP '+' (1, 32) (1, 33) - STRING 'R"ABC"' (1, 34) (1, 41) + STRING 'r"abc"' (1, 4) (1, 10) + OP '+' (1, 11) (1, 12) + STRING 'r"ABC"' (1, 13) (1, 19) + OP '+' (1, 20) (1, 21) + STRING 'R"ABC"' (1, 22) (1, 28) + OP '+' (1, 29) (1, 30) + STRING 'R"ABC"' (1, 31) (1, 37) Operators @@ -359,7 +359,7 @@ Shift Additive - >>> dump_tokens("x = 1 - y + 15 - 01 + 0x124 + z + a[5]") + >>> dump_tokens("x = 1 - y + 15 - 1 + 0x124 + z + a[5]") NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '1' (1, 4) (1, 5) @@ -368,16 +368,16 @@ Additive OP '+' (1, 10) (1, 11) NUMBER '15' (1, 12) (1, 14) OP '-' (1, 15) (1, 16) - NUMBER '01' (1, 17) (1, 19) - OP '+' (1, 20) (1, 21) - NUMBER '0x124' (1, 22) (1, 27) - OP '+' (1, 28) (1, 29) - NAME 'z' (1, 30) (1, 31) - OP '+' (1, 32) (1, 33) - NAME 'a' (1, 34) (1, 35) - OP '[' (1, 35) (1, 36) - NUMBER '5' (1, 36) (1, 37) - OP ']' (1, 37) (1, 38) + NUMBER '1' (1, 17) (1, 18) + OP '+' (1, 19) (1, 20) + NUMBER '0x124' (1, 21) (1, 26) + OP '+' (1, 27) (1, 28) + NAME 'z' (1, 29) (1, 30) + OP '+' (1, 31) (1, 32) + NAME 'a' (1, 33) (1, 34) + OP '[' (1, 34) (1, 35) + NUMBER '5' (1, 35) (1, 36) + OP ']' (1, 36) (1, 37) Multiplicative |