bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index d825560..c8d191d 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -987,6 +987,14 @@ def test_invalid_line_continuation_left_recursive(self):
self._check_error("A.\u03bc\\\n",
"unexpected EOF while parsing")
+ def test_error_parenthesis(self):
+ for paren in "([{":
+ self._check_error(paren + "1 + 2", f"\\{paren}' was never closed")
+
+ for paren in ")]}":
+ self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+
+
def test_main():
support.run_unittest(SyntaxTestCase)
from test import test_syntax