summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2024-06-12 18:52:55 (GMT)
committerGitHub <noreply@github.com>2024-06-12 18:52:55 (GMT)
commit4b5d3e0e721a952f4ac9d17bee331e6dfe543dcd (patch)
tree1ca91967559efe099b4e0666c8d3c70f27e34902 /Lib
parent127c1d2771749853e287632c086b6054212bf12a (diff)
downloadcpython-4b5d3e0e721a952f4ac9d17bee331e6dfe543dcd.zip
cpython-4b5d3e0e721a952f4ac9d17bee331e6dfe543dcd.tar.gz
cpython-4b5d3e0e721a952f4ac9d17bee331e6dfe543dcd.tar.bz2
gh-120343: Fix column offsets of multiline tokens in tokenize (#120391)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_tokenize.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 36dba71..51aeb35 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -1210,6 +1210,20 @@ a = f'''
FSTRING_END "\'\'\'" (2, 68) (2, 71)
""")
+ def test_multiline_non_ascii_fstring_with_expr(self):
+ self.check_tokenize("""\
+f'''
+ šŸ”— This is a test {test_arg1}šŸ”—
+šŸ”—'''""", """\
+ FSTRING_START "f\'\'\'" (1, 0) (1, 4)
+ FSTRING_MIDDLE '\\n šŸ”— This is a test ' (1, 4) (2, 21)
+ OP '{' (2, 21) (2, 22)
+ NAME 'test_arg1' (2, 22) (2, 31)
+ OP '}' (2, 31) (2, 32)
+ FSTRING_MIDDLE 'šŸ”—\\nšŸ”—' (2, 32) (3, 1)
+ FSTRING_END "\'\'\'" (3, 1) (3, 4)
+ """)
+
class GenerateTokensTest(TokenizeTest):
def check_tokenize(self, s, expected):
# Format the tokens in s in a table format.