mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-104866: Tokenize should emit NEWLINE after exiting block with comment (#104870)
This commit is contained in:
parent
9d457e1154
commit
c90a862cdc
2 changed files with 23 additions and 3 deletions
|
@ -1057,6 +1057,23 @@ async def f():
|
|||
DEDENT '' (6, 12) (6, 12)
|
||||
""")
|
||||
|
||||
def test_newline_after_parenthesized_block_with_comment(self):
|
||||
self.check_tokenize('''\
|
||||
[
|
||||
# A comment here
|
||||
1
|
||||
]
|
||||
''', """\
|
||||
OP '[' (1, 0) (1, 1)
|
||||
NL '\\n' (1, 1) (1, 2)
|
||||
COMMENT '# A comment here' (2, 4) (2, 20)
|
||||
NL '\\n' (2, 20) (2, 21)
|
||||
NUMBER '1' (3, 4) (3, 5)
|
||||
NL '\\n' (3, 5) (3, 6)
|
||||
OP ']' (4, 0) (4, 1)
|
||||
NEWLINE '\\n' (4, 1) (4, 2)
|
||||
""")
|
||||
|
||||
class GenerateTokensTest(TokenizeTest):
|
||||
def check_tokenize(self, s, expected):
|
||||
# Format the tokens in s in a table format.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue