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

Original file line numberDiff line numberDiff line change

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

615615

],

616616

)

617617
618+

def test_syntaxerror_invalid_escape_sequence_multi_line(self):

619+

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

620+

with support.temp_dir() as script_dir:

621+

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

622+

exitcode, stdout, stderr = assert_python_failure(

623+

'-Werror', script_name,

624+

)

625+

self.assertEqual(

626+

stderr.splitlines()[-3:],

627+

[

628+

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

629+

b' ^',

630+

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

631+

],

632+

)

633+
618634

def test_consistent_sys_path_for_direct_execution(self):

619635

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

620636

# sys.path configuration: