bpo-40246: Fix test_fstring when run with the old parser (GH-20402)

This commit is contained in:
Lysandros Nikolaou 2020-05-26 03:10:00 +03:00 committed by GitHub
parent 3c6c86ab77
commit 6cb0ad2039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import ast
import types
import decimal
import unittest
from test.support import use_old_parser
a_global = 'global variable'
@ -864,7 +865,12 @@ non-important content
"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):