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):
650
650
self .check_ast_roundtrip ("""f'''""\" ''\\ '{""\" \\ n\\ "'''""\" '''\\ n'''}''' """ )
651
651
652
652
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
+
654
659
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
+
656
665
self .check_ast_roundtrip ("""f"{x:\\ \\ \\ \\ }" """ )
657
666
658
667
def test_quote_in_format_spec (self ):
You can’t perform that action at this time.
0 commit comments