summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-15 00:36:40 (GMT)
committerGitHub <noreply@github.com>2023-06-15 00:36:40 (GMT)
commit638c2bacde87abbcc7dc067564941d707aed788c (patch)
tree0636f8cade1897d9393ff393b34e2bf7f7ac1b45 /Lib/test
parent52a2bbdc9d6d62bad34d9bc42db613ea498ded1a (diff)
downloadcpython-638c2bacde87abbcc7dc067564941d707aed788c.zip
cpython-638c2bacde87abbcc7dc067564941d707aed788c.tar.gz
cpython-638c2bacde87abbcc7dc067564941d707aed788c.tar.bz2
[3.12] gh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (GH-105801) (#105806)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test')
-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 031b94d..cbb0308 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -907,6 +907,9 @@ x = (
with self.assertWarns(DeprecationWarning): # invalid escape sequence
value = eval(r"f'\{6*7}'")
self.assertEqual(value, '\\42')
+ with self.assertWarns(SyntaxWarning): # invalid escape sequence
+ value = eval(r"f'\g'")
+ self.assertEqual(value, '\\g')
self.assertEqual(f'\\{6*7}', '\\42')
self.assertEqual(fr'\{6*7}', '\\42')