Skip to content

[3.9] bpo-40246: Fix test_fstring when run with the old parser #20402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import types
import decimal
import unittest
from test.support import use_old_parser

a_global = 'global variable'

Expand Down Expand Up @@ -864,7 +865,12 @@ def test_invalid_string_prefixes(self):
"Bf''",
"BF''",]
double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
error_msg = (
'invalid syntax'
if use_old_parser()
else 'unexpected EOF while parsing'
)
self.assertAllRaise(SyntaxError, error_msg,
single_quote_cases + double_quote_cases)

def test_leading_trailing_spaces(self):
Expand Down