summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-03-22 16:24:39 (GMT)
committerGitHub <noreply@github.com>2021-03-22 16:24:39 (GMT)
commit123ff266cda9ad279106f20dca06ba114f6a9b8a (patch)
treed3df53642d022b546b718f9e4bffbc1477684528 /Lib/test/test_cmd_line.py
parent39f643614d03748a5fad462fe7ed26a174a522fa (diff)
downloadcpython-123ff266cda9ad279106f20dca06ba114f6a9b8a.zip
cpython-123ff266cda9ad279106f20dca06ba114f6a9b8a.tar.gz
cpython-123ff266cda9ad279106f20dca06ba114f6a9b8a.tar.bz2
bpo-43591: Fix error location in interactive mode for errors at the end of the line (GH-24973)
Co-authored-by: Erlend Egeberg Aasland
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r--Lib/test/test_cmd_line.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index e87eede..25d3eec 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -851,13 +851,19 @@ class IgnoreEnvironmentTest(unittest.TestCase):
)
class SyntaxErrorTests(unittest.TestCase):
- def test_tokenizer_error_with_stdin(self):
- proc = subprocess.run([sys.executable, "-"], input = b"(1+2+3",
+ def check_string(self, code):
+ proc = subprocess.run([sys.executable, "-"], input=code,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.assertNotEqual(proc.returncode, 0)
self.assertNotEqual(proc.stderr, None)
self.assertIn(b"\nSyntaxError", proc.stderr)
+ def test_tokenizer_error_with_stdin(self):
+ self.check_string(b"(1+2+3")
+
+ def test_decoding_error_at_the_end_of_the_line(self):
+ self.check_string(b"'\u1f'")
+
def test_main():
support.run_unittest(CmdLineTest, IgnoreEnvironmentTest, SyntaxErrorTests)
support.reap_children()