mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Add additional test for multi-line SyntaxError (GH-15003)
(cherry picked from commit 44212ec811
)
Co-authored-by: Anthony Sottile <asottile@umich.edu>
This commit is contained in:
parent
9ea738e580
commit
bf0b8a6cb2
1 changed files with 16 additions and 0 deletions
|
@ -615,6 +615,22 @@ class CmdLineTest(unittest.TestCase):
|
|||
],
|
||||
)
|
||||
|
||||
def test_syntaxerror_invalid_escape_sequence_multi_line(self):
|
||||
script = 'foo = """\\q\n"""\n'
|
||||
with support.temp_dir() as script_dir:
|
||||
script_name = _make_test_script(script_dir, 'script', script)
|
||||
exitcode, stdout, stderr = assert_python_failure(
|
||||
'-Werror', script_name,
|
||||
)
|
||||
self.assertEqual(
|
||||
stderr.splitlines()[-3:],
|
||||
[
|
||||
b' foo = """\\q',
|
||||
b' ^',
|
||||
b'SyntaxError: invalid escape sequence \\q',
|
||||
],
|
||||
)
|
||||
|
||||
def test_consistent_sys_path_for_direct_execution(self):
|
||||
# This test case ensures that the following all give the same
|
||||
# sys.path configuration:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue