mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-129693: Suppress SyntaxWarning
in test_fstring (#129830)
Suppress SyntaxWarning in test_fstring
This commit is contained in:
parent
e09442089e
commit
2dd018848c
1 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,7 @@ import re
|
|||
import types
|
||||
import decimal
|
||||
import unittest
|
||||
import warnings
|
||||
from test import support
|
||||
from test.support.os_helper import temp_cwd
|
||||
from test.support.script_helper import assert_python_failure, assert_python_ok
|
||||
|
@ -1650,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