diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2020-06-16 00:27:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 00:27:33 (GMT) |
commit | 113e2b0a07c72c0d5e3489076afb14f6b3ad1049 (patch) | |
tree | 286d9d282f1e5290706475f2409bc4e332bd2738 /Lib/test/test_eof.py | |
parent | 8666356280084f0426c28a981341f72eaaacd006 (diff) | |
download | cpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.zip cpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.tar.gz cpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.tar.bz2 |
bpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)
When a file ends with a line that contains a line continuation character
the text of the emitted SyntaxError is empty, contrary to the old
parser, where the error text contained the text of the last line.
Diffstat (limited to 'Lib/test/test_eof.py')
-rw-r--r-- | Lib/test/test_eof.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py index bebad31..51cbbd8 100644 --- a/Lib/test/test_eof.py +++ b/Lib/test/test_eof.py @@ -52,10 +52,14 @@ class EOFTestCase(unittest.TestCase): file_name = script_helper.make_script(temp_dir, 'foo', '\\') rc, out, err = script_helper.assert_python_failure(file_name) self.assertIn(b'unexpected EOF while parsing', err) + self.assertIn(b'line 2', err) + self.assertIn(b'\\', err) file_name = script_helper.make_script(temp_dir, 'foo', 'y = 6\\') rc, out, err = script_helper.assert_python_failure(file_name) self.assertIn(b'unexpected EOF while parsing', err) + self.assertIn(b'line 2', err) + self.assertIn(b'y = 6\\', err) if __name__ == "__main__": unittest.main() |