summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tokenize.py
diff options
context:
space:
mode:
authorEric V. Smith <eric@trueblade.com>2015-10-26 08:37:55 (GMT)
committerEric V. Smith <eric@trueblade.com>2015-10-26 08:37:55 (GMT)
commit1c8222c80a8a534bd9357aafc3fba7b6927efc15 (patch)
tree32fcc8bf6c668924083e9b3aa80353e7c6e879af /Lib/test/test_tokenize.py
parentf1c47e47514e1cf1006dc21de386af7ee25f8db5 (diff)
downloadcpython-1c8222c80a8a534bd9357aafc3fba7b6927efc15.zip
cpython-1c8222c80a8a534bd9357aafc3fba7b6927efc15.tar.gz
cpython-1c8222c80a8a534bd9357aafc3fba7b6927efc15.tar.bz2
Issue 25311: Add support for f-strings to tokenize.py. Also added some comments to explain what's happening, since it's not so obvious.
Diffstat (limited to 'Lib/test/test_tokenize.py')
-rw-r--r--Lib/test/test_tokenize.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index b74396f..90438e7 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -333,6 +333,23 @@ b\
c"""', """\
STRING 'rb"\""a\\\\\\nb\\\\\\nc"\""' (1, 0) (3, 4)
""")
+ self.check_tokenize('f"abc"', """\
+ STRING 'f"abc"' (1, 0) (1, 6)
+ """)
+ self.check_tokenize('fR"a{b}c"', """\
+ STRING 'fR"a{b}c"' (1, 0) (1, 9)
+ """)
+ self.check_tokenize('f"""abc"""', """\
+ STRING 'f\"\"\"abc\"\"\"' (1, 0) (1, 10)
+ """)
+ self.check_tokenize(r'f"abc\
+def"', """\
+ STRING 'f"abc\\\\\\ndef"' (1, 0) (2, 4)
+ """)
+ self.check_tokenize(r'Rf"abc\
+def"', """\
+ STRING 'Rf"abc\\\\\\ndef"' (1, 0) (2, 4)
+ """)
def test_function(self):
self.check_tokenize("def d22(a, b, c=2, d=2, *k): pass", """\