File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -650,9 +650,18 @@ def test_multiquote_joined_string(self):
650650 self .check_ast_roundtrip ("""f'''""\" ''\\ '{""\" \\ n\\ "'''""\" '''\\ n'''}''' """ )
651651
652652 def test_backslash_in_format_spec (self ):
653- self .check_ast_roundtrip ("""f"{x:\\ }" """ )
653+ import re
654+ msg = re .escape ("invalid escape sequence '\\ '" )
655+ with self .assertWarnsRegex (SyntaxWarning , msg ):
656+ self .check_ast_roundtrip ("""f"{x:\\ }" """ )
657+ self .check_ast_roundtrip ("""f"{x:\\ n}" """ )
658+
654659 self .check_ast_roundtrip ("""f"{x:\\ \\ }" """ )
655- self .check_ast_roundtrip ("""f"{x:\\ \\ \\ }" """ )
660+
661+ with self .assertWarnsRegex (SyntaxWarning , msg ):
662+ self .check_ast_roundtrip ("""f"{x:\\ \\ \\ }" """ )
663+ self .check_ast_roundtrip ("""f"{x:\\ \\ \\ n}" """ )
664+
656665 self .check_ast_roundtrip ("""f"{x:\\ \\ \\ \\ }" """ )
657666
658667 def test_quote_in_format_spec (self ):
You can’t perform that action at this time.
0 commit comments