mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782)
This commit is contained in:
parent
719e14d283
commit
76c1b4d5c5
6 changed files with 80 additions and 112 deletions
|
|
@ -599,7 +599,7 @@ class CmdLineTest(unittest.TestCase):
|
|||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||
text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read()
|
||||
# Confirm that the caret is located under the first 1 character
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
|
||||
def test_syntaxerror_indented_caret_position(self):
|
||||
script = textwrap.dedent("""\
|
||||
|
|
@ -611,7 +611,7 @@ class CmdLineTest(unittest.TestCase):
|
|||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||
text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read()
|
||||
# Confirm that the caret is located under the first 1 character
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
|
||||
# Try the same with a form feed at the start of the indented line
|
||||
script = (
|
||||
|
|
@ -622,7 +622,7 @@ class CmdLineTest(unittest.TestCase):
|
|||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||
text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read()
|
||||
self.assertNotIn("\f", text)
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
self.assertIn("\n 1 + 1 = 2\n ^", text)
|
||||
|
||||
def test_syntaxerror_multi_line_fstring(self):
|
||||
script = 'foo = f"""{}\nfoo"""\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue