summaryrefslogtreecommitdiff
path: root/Lib/test/test_cmd_line_script.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-04-12 16:59:30 +0100
committerGitHub <noreply@github.com>2021-04-12 16:59:30 +0100
commitb86ed8e3bb41ede77eeab4a8bb4e2b91a8065283 (patch)
tree250e32e95a6bead87006d2e1e1a06d9058fc3b91 /Lib/test/test_cmd_line_script.py
parent2459b92a4db69d9b14d0a86a9b81cc075894e910 (diff)
downloadcpython-git-b86ed8e3bb41ede77eeab4a8bb4e2b91a8065283.tar.gz
bpo-43797: Improve syntax error for invalid comparisons (#25317)
* bpo-43797: Improve syntax error for invalid comparisons * Update Lib/test/test_fstring.py Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> * Apply review comments * can't -> cannot Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r--Lib/test/test_cmd_line_script.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 8f12b1e19b..2e0b5f72c2 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -600,8 +600,8 @@ class CmdLineTest(unittest.TestCase):
script_name = _make_test_script(script_dir, 'script', script)
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)
+ # Confirm that the caret is located under the '=' sign
+ self.assertIn("\n 1 + 1 = 2\n ^\n", text)
def test_syntaxerror_indented_caret_position(self):
script = textwrap.dedent("""\
@@ -613,7 +613,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 ^\n", text)
# Try the same with a form feed at the start of the indented line
script = (
@@ -624,7 +624,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 ^\n", text)
def test_syntaxerror_multi_line_fstring(self):
script = 'foo = f"""{}\nfoo"""\n'