https://github.com/python/cpython/commit/a76aff6ea45abf92cd21321322a5dc823a37b208
commit: a76aff6ea45abf92cd21321322a5dc823a37b208
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-02-13T02:03:00Z
summary:

[3.13] gh-129693: Suppress `SyntaxWarning` in test_fstring (GH-129830) (#130068)

gh-129693: Suppress `SyntaxWarning` in test_fstring (GH-129830)

Suppress SyntaxWarning in test_fstring
(cherry picked from commit 2dd018848ca254047835850b8b95d805cbf7efaf)

Co-authored-by: Tomas R <[email protected]>

files:
M Lib/test/test_fstring.py

diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 6e217ef63be618..f5111b38a45707 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -1651,8 +1651,9 @@ def __repr__(self):
         #self.assertEqual(f'X{x =       }Y', 'Xx\t=\t'+repr(x)+'Y')
 
     def test_debug_expressions_are_raw_strings(self):
-
-        self.assertEqual(f'{b"\N{OX}"=}', 'b"\\N{OX}"=b\'\\\\N{OX}\'')
+        with warnings.catch_warnings():
+            warnings.simplefilter('ignore', SyntaxWarning)
+            self.assertEqual(eval("""f'{b"\\N{OX}"=}'"""), 
'b"\\N{OX}"=b\'\\\\N{OX}\'')
         self.assertEqual(f'{r"\xff"=}', 'r"\\xff"=\'\\\\xff\'')
         self.assertEqual(f'{r"\n"=}', 'r"\\n"=\'\\\\n\'')
         self.assertEqual(f"{'\''=}", "'\\''=\"'\"")

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to