Skip to content

bpo-37433: Add additional test for multi-line SyntaxError #15003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Lib/test/test_cmd_line_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,22 @@ def test_syntaxerror_multi_line_fstring(self):
],
)

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:
Expand Down