summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2023-11-20 15:38:57 (GMT)
committerGitHub <noreply@github.com>2023-11-20 15:38:57 (GMT)
commit7e70e2ed29703e3d06d0908be5c7836a67bae785 (patch)
tree0610e1dcd302e0f9b916e68125ebf8adb0610964 /Lib/test/test_fstring.py
parentd4fd165abab9c00ef15fbcd262804163e1a5e389 (diff)
downloadcpython-7e70e2ed29703e3d06d0908be5c7836a67bae785.zip
cpython-7e70e2ed29703e3d06d0908be5c7836a67bae785.tar.gz
cpython-7e70e2ed29703e3d06d0908be5c7836a67bae785.tar.bz2
[3.12] gh-112243: Don't include comments in f-string debug expressions (GH-112284) (#112285)
(cherry picked from commit d59feb5dbe5395615d06c30a95e6a6a9b7681d4d)
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r--Lib/test/test_fstring.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 4f05a14..fb364e9 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -1579,6 +1579,9 @@ x = (
self.assertEqual(f'X{x = }Y', 'Xx = '+repr(x)+'Y')
self.assertEqual(f"sadsd {1 + 1 = :{1 + 1:1d}f}", "sadsd 1 + 1 = 2.000000")
+ self.assertEqual(f"{1+2 = # my comment
+ }", '1+2 = \n 3')
+
# These next lines contains tabs. Backslash escapes don't
# work in f-strings.
# patchcheck doesn't like these tabs. So the only way to test