]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40246: Fix test_fstring when run with the old parser (GH-20402)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Tue, 26 May 2020 00:10:00 +0000 (03:10 +0300)
committerGitHub <noreply@github.com>
Tue, 26 May 2020 00:10:00 +0000 (01:10 +0100)
Lib/test/test_fstring.py

index e0bb5b56b2614f44992daf5748e7f85ec990623d..e423b52cd585528a465c509dcdec700651c4532b 100644 (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):