Skip to content

Commit 081f5a2

Browse files
authored
Merge pull request #46 from mgmacias95/fstring-grammar-rebased-after-sprint
test: Fix fstring related tests in test_tokenize.py
2 parents b41a3b8 + 3c2aea4 commit 081f5a2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Lib/test/test_tokenize.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,25 +1937,34 @@ def test_string(self):
19371937
""")
19381938

19391939
self.check_tokenize('f"abc"', """\
1940-
STRING 'f"abc"' (1, 0) (1, 6)
1940+
FSTRING_START 'f"' (1, 0) (1, 2)
1941+
FSTRING_END 'abc' (1, 2) (1, 5)
19411942
""")
19421943

19431944
self.check_tokenize('fR"a{b}c"', """\
1944-
STRING 'fR"a{b}c"' (1, 0) (1, 9)
1945+
FSTRING_START 'fR"' (1, 0) (1, 3)
1946+
FSTRING_MIDDLE 'a' (1, 3) (1, 4)
1947+
LBRACE '{' (1, 4) (1, 5)
1948+
NAME 'b' (1, 5) (1, 6)
1949+
RBRACE '}' (1, 6) (1, 7)
1950+
FSTRING_END 'c' (1, 7) (1, 8)
19451951
""")
19461952

19471953
self.check_tokenize('f"""abc"""', """\
1948-
STRING 'f\"\"\"abc\"\"\"' (1, 0) (1, 10)
1954+
FSTRING_START 'f\"""' (1, 0) (1, 4)
1955+
FSTRING_END 'abc' (1, 4) (1, 7)
19491956
""")
19501957

19511958
self.check_tokenize(r'f"abc\
19521959
def"', """\
1953-
STRING 'f"abc\\\\\\ndef"' (1, 0) (2, 4)
1960+
FSTRING_START \'f"\' (1, 0) (1, 2)
1961+
FSTRING_END 'abc\\\\\\ndef' (1, 2) (2, 3)
19541962
""")
19551963

19561964
self.check_tokenize(r'Rf"abc\
19571965
def"', """\
1958-
STRING 'Rf"abc\\\\\\ndef"' (1, 0) (2, 4)
1966+
FSTRING_START 'Rf"' (1, 0) (1, 3)
1967+
FSTRING_END 'abc\\\\\\ndef' (1, 3) (2, 3)
19591968
""")
19601969

19611970
def test_function(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy