summaryrefslogtreecommitdiff
path: root/Lib/test/test_eof.py
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-06-16 03:27:33 +0300
committerGitHub <noreply@github.com>2020-06-16 01:27:33 +0100
commit113e2b0a07c72c0d5e3489076afb14f6b3ad1049 (patch)
tree286d9d282f1e5290706475f2409bc4e332bd2738 /Lib/test/test_eof.py
parent8666356280084f0426c28a981341f72eaaacd006 (diff)
downloadcpython-git-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.tar.gz
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.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index bebad31061..51cbbd8eed 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()