Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e149448 commit c5c8111Copy full SHA for c5c8111
Lib/test/test_fstring.py
@@ -1048,10 +1048,10 @@ def test_fstring_backslash_before_double_bracket(self):
1048
self.assertEqual(fr'{1+1}\}}', '2\\}')
1049
1050
def test_fstring_backslash_before_double_bracket_warns_once(self):
1051
- with warnings.catch_warnings(record=True) as w:
+ with self.assertWarns(SyntaxWarning) as w:
1052
eval(r"f'\{{'")
1053
- self.assertEqual(len(w), 1)
1054
- self.assertEqual(w[0].category, SyntaxWarning)
+ self.assertEqual(len(w.warnings), 1)
+ self.assertEqual(w.warnings[0].category, SyntaxWarning)
1055
1056
def test_fstring_backslash_prefix_raw(self):
1057
self.assertEqual(f'\\', '\\')
0 commit comments