summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-05-26 00:10:00 (GMT)
committerGitHub <noreply@github.com>2020-05-26 00:10:00 (GMT)
commit6cb0ad20396116b5076a58b05b55286d6d5e0c94 (patch)
tree117a0d61208ad4f1cbbf54a64a8b426cd863b220
parent3c6c86ab77464e6bcb489064d0ec1be5d1b19f3a (diff)
downloadcpython-6cb0ad20396116b5076a58b05b55286d6d5e0c94.zip
cpython-6cb0ad20396116b5076a58b05b55286d6d5e0c94.tar.gz
cpython-6cb0ad20396116b5076a58b05b55286d6d5e0c94.tar.bz2
bpo-40246: Fix test_fstring when run with the old parser (GH-20402)
-rw-r--r--Lib/test/test_fstring.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index e0bb5b5..e423b52 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -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):