mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
[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 2dd018848c
)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
This commit is contained in:
parent
8d1d36b742
commit
a76aff6ea4
1 changed files with 3 additions and 2 deletions
|
@ -1651,8 +1651,9 @@ x = (
|
|||
#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"{'\''=}", "'\\''=\"'\"")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue