File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11"""test script for a few new invalid token catches"""
22
33import sys
4+ import warnings
45from test import support
56from test .support import os_helper
67from test .support import script_helper
@@ -38,12 +39,14 @@ def test_EOFS_with_file(self):
3839
3940 def test_eof_with_line_continuation (self ):
4041 expect = "unexpected EOF while parsing (<string>, line 1)"
41- try :
42- compile ('"\\ Xhh" \\ ' , '<string>' , 'exec' )
43- except SyntaxError as msg :
44- self .assertEqual (str (msg ), expect )
45- else :
46- raise support .TestFailed
42+ with warnings .catch_warnings ():
43+ warnings .simplefilter ("ignore" , SyntaxWarning )
44+ try :
45+ compile ('"\\ Xhh" \\ ' , '<string>' , 'exec' )
46+ except SyntaxError as msg :
47+ self .assertEqual (str (msg ), expect )
48+ else :
49+ raise support .TestFailed
4750
4851 def test_line_continuation_EOF (self ):
4952 """A continuation at the end of input must be an error; bpo2180."""
You can’t perform that action at this time.
0 commit comments