summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-07-29 13:59:13 (GMT)
committerPablo Galindo <Pablogsal@gmail.com>2019-07-29 13:59:13 (GMT)
commit5b94f3578c662d5f1ee90c0e6b81481d9ec82d89 (patch)
tree3f57146c75113283e71a598108cfb4d7295443bb /Lib
parente1b900247227dad49d8231f1d028872412230ab4 (diff)
downloadcpython-5b94f3578c662d5f1ee90c0e6b81481d9ec82d89.zip
cpython-5b94f3578c662d5f1ee90c0e6b81481d9ec82d89.tar.gz
cpython-5b94f3578c662d5f1ee90c0e6b81481d9ec82d89.tar.bz2
Fix `SyntaxError` indicator printing too many spaces for multi-line strings (GH-14433)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_cmd_line_script.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 4677e60..633e0fd 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -613,6 +613,20 @@ class CmdLineTest(unittest.TestCase):
self.assertNotIn("\f", text)
self.assertIn("\n 1 + 1 = 2\n ^", text)
+ def test_syntaxerror_multi_line_fstring(self):
+ script = 'foo = f"""{}\nfoo"""\n'
+ with support.temp_dir() as script_dir:
+ script_name = _make_test_script(script_dir, 'script', script)
+ exitcode, stdout, stderr = assert_python_failure(script_name)
+ self.assertEqual(
+ stderr.splitlines()[-3:],
+ [
+ b' foo = f"""{}',
+ b' ^',
+ b'SyntaxError: f-string: empty expression not allowed',
+ ],
+ )
+
def test_consistent_sys_path_for_direct_execution(self):
# This test case ensures that the following all give the same
# sys.path configuration: