mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-105564: Don't include artificial newlines in the line attribute of tokens (#105565)
This commit is contained in:
parent
1dd267af64
commit
d7f46bcd98
4 changed files with 30 additions and 25 deletions
|
@ -552,14 +552,14 @@ class TestPegen(unittest.TestCase):
|
|||
string="D",
|
||||
start=(1, 0),
|
||||
end=(1, 1),
|
||||
line="D A C A E\n",
|
||||
line="D A C A E",
|
||||
),
|
||||
TokenInfo(
|
||||
type=NAME,
|
||||
string="A",
|
||||
start=(1, 2),
|
||||
end=(1, 3),
|
||||
line="D A C A E\n",
|
||||
line="D A C A E",
|
||||
),
|
||||
],
|
||||
TokenInfo(
|
||||
|
@ -567,7 +567,7 @@ class TestPegen(unittest.TestCase):
|
|||
string="C",
|
||||
start=(1, 4),
|
||||
end=(1, 5),
|
||||
line="D A C A E\n",
|
||||
line="D A C A E",
|
||||
),
|
||||
],
|
||||
TokenInfo(
|
||||
|
@ -575,11 +575,11 @@ class TestPegen(unittest.TestCase):
|
|||
string="A",
|
||||
start=(1, 6),
|
||||
end=(1, 7),
|
||||
line="D A C A E\n",
|
||||
line="D A C A E",
|
||||
),
|
||||
],
|
||||
TokenInfo(
|
||||
type=NAME, string="E", start=(1, 8), end=(1, 9), line="D A C A E\n"
|
||||
type=NAME, string="E", start=(1, 8), end=(1, 9), line="D A C A E"
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -594,22 +594,22 @@ class TestPegen(unittest.TestCase):
|
|||
string="B",
|
||||
start=(1, 0),
|
||||
end=(1, 1),
|
||||
line="B C A E\n",
|
||||
line="B C A E",
|
||||
),
|
||||
TokenInfo(
|
||||
type=NAME,
|
||||
string="C",
|
||||
start=(1, 2),
|
||||
end=(1, 3),
|
||||
line="B C A E\n",
|
||||
line="B C A E",
|
||||
),
|
||||
],
|
||||
TokenInfo(
|
||||
type=NAME, string="A", start=(1, 4), end=(1, 5), line="B C A E\n"
|
||||
type=NAME, string="A", start=(1, 4), end=(1, 5), line="B C A E"
|
||||
),
|
||||
],
|
||||
TokenInfo(
|
||||
type=NAME, string="E", start=(1, 6), end=(1, 7), line="B C A E\n"
|
||||
type=NAME, string="E", start=(1, 6), end=(1, 7), line="B C A E"
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -655,10 +655,10 @@ class TestPegen(unittest.TestCase):
|
|||
node,
|
||||
[
|
||||
TokenInfo(
|
||||
NAME, string="foo", start=(1, 0), end=(1, 3), line="foo = 12 + 12 .\n"
|
||||
NAME, string="foo", start=(1, 0), end=(1, 3), line="foo = 12 + 12 ."
|
||||
),
|
||||
TokenInfo(
|
||||
OP, string="=", start=(1, 4), end=(1, 5), line="foo = 12 + 12 .\n"
|
||||
OP, string="=", start=(1, 4), end=(1, 5), line="foo = 12 + 12 ."
|
||||
),
|
||||
[
|
||||
TokenInfo(
|
||||
|
@ -666,7 +666,7 @@ class TestPegen(unittest.TestCase):
|
|||
string="12",
|
||||
start=(1, 6),
|
||||
end=(1, 8),
|
||||
line="foo = 12 + 12 .\n",
|
||||
line="foo = 12 + 12 .",
|
||||
),
|
||||
[
|
||||
[
|
||||
|
@ -675,14 +675,14 @@ class TestPegen(unittest.TestCase):
|
|||
string="+",
|
||||
start=(1, 9),
|
||||
end=(1, 10),
|
||||
line="foo = 12 + 12 .\n",
|
||||
line="foo = 12 + 12 .",
|
||||
),
|
||||
TokenInfo(
|
||||
NUMBER,
|
||||
string="12",
|
||||
start=(1, 11),
|
||||
end=(1, 13),
|
||||
line="foo = 12 + 12 .\n",
|
||||
line="foo = 12 + 12 .",
|
||||
),
|
||||
]
|
||||
],
|
||||
|
@ -734,9 +734,9 @@ class TestPegen(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
node,
|
||||
[
|
||||
TokenInfo(OP, string="(", start=(1, 0), end=(1, 1), line="(1)\n"),
|
||||
TokenInfo(NUMBER, string="1", start=(1, 1), end=(1, 2), line="(1)\n"),
|
||||
TokenInfo(OP, string=")", start=(1, 2), end=(1, 3), line="(1)\n"),
|
||||
TokenInfo(OP, string="(", start=(1, 0), end=(1, 1), line="(1)"),
|
||||
TokenInfo(NUMBER, string="1", start=(1, 1), end=(1, 2), line="(1)"),
|
||||
TokenInfo(OP, string=")", start=(1, 2), end=(1, 3), line="(1)"),
|
||||
],
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue