diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-07-29 15:05:55 (GMT) |
---|---|---|
committer | Pablo Galindo <Pablogsal@gmail.com> | 2019-07-29 15:05:55 (GMT) |
commit | 44212ec8111febfe5fc6c6ed231d4ef2d98bd7e2 (patch) | |
tree | 87ae3743583d36dca006e019153f96a8d1376b2f | |
parent | 5b94f3578c662d5f1ee90c0e6b81481d9ec82d89 (diff) | |
download | cpython-44212ec8111febfe5fc6c6ed231d4ef2d98bd7e2.zip cpython-44212ec8111febfe5fc6c6ed231d4ef2d98bd7e2.tar.gz cpython-44212ec8111febfe5fc6c6ed231d4ef2d98bd7e2.tar.bz2 |
Add additional test for multi-line SyntaxError (GH-15003)
-rw-r--r-- | Lib/test/test_cmd_line_script.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py index 633e0fd..80198f8 100644 --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -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: |