Add additional test for multi-line SyntaxError (GH-15003) · python/cpython@44212ec

Original file line numberDiff line numberDiff line change

@@ -627,6 +627,22 @@ def test_syntaxerror_multi_line_fstring(self):

627627

],

628628

)

629629
630+

def test_syntaxerror_invalid_escape_sequence_multi_line(self):

631+

script = 'foo = """\\q\n"""\n'

632+

with support.temp_dir() as script_dir:

633+

script_name = _make_test_script(script_dir, 'script', script)

634+

exitcode, stdout, stderr = assert_python_failure(

635+

'-Werror', script_name,

636+

)

637+

self.assertEqual(

638+

stderr.splitlines()[-3:],

639+

[

640+

b' foo = """\\q',

641+

b' ^',

642+

b'SyntaxError: invalid escape sequence \\q',

643+

],

644+

)

645+
630646

def test_consistent_sys_path_for_direct_execution(self):

631647

# This test case ensures that the following all give the same

632648

# sys.path configuration: