mirror of
https://github.com/python/cpython.git
synced 2024-11-28 04:15:11 +08:00
Add additional test for multi-line SyntaxError (GH-15003)
This commit is contained in:
parent
5b94f3578c
commit
44212ec811
@ -627,6 +627,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…
Reference in New Issue
Block a user