bpo-33306: Improve SyntaxError messages for unbalanced parentheses. (GH-6516)
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 09b5ae1..fe3804b 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -1004,10 +1004,14 @@
self.assertEqual('{d[0]}'.format(d=d), 'integer')
def test_invalid_expressions(self):
- self.assertAllRaise(SyntaxError, 'invalid syntax',
- [r"f'{a[4)}'",
- r"f'{a(4]}'",
- ])
+ self.assertAllRaise(SyntaxError,
+ r"closing parenthesis '\)' does not match "
+ r"opening parenthesis '\[' \(<fstring>, line 1\)",
+ [r"f'{a[4)}'"])
+ self.assertAllRaise(SyntaxError,
+ r"closing parenthesis '\]' does not match "
+ r"opening parenthesis '\(' \(<fstring>, line 1\)",
+ [r"f'{a(4]}'"])
def test_errors(self):
# see issue 26287