Skip to content

Commit 6cb0ad2

Browse files
authored
bpo-40246: Fix test_fstring when run with the old parser (GH-20402)
1 parent 3c6c86a commit 6cb0ad2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_fstring.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import types
1212
import decimal
1313
import unittest
14+
from test.support import use_old_parser
1415

1516
a_global = 'global variable'
1617

@@ -864,7 +865,12 @@ def test_invalid_string_prefixes(self):
864865
"Bf''",
865866
"BF''",]
866867
double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
867-
self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
868+
error_msg = (
869+
'invalid syntax'
870+
if use_old_parser()
871+
else 'unexpected EOF while parsing'
872+
)
873+
self.assertAllRaise(SyntaxError, error_msg,
868874
single_quote_cases + double_quote_cases)
869875

870876
def test_leading_trailing_spaces(self):

0 commit comments

Comments
 (0)