summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorShantanu <hauntsaninja@users.noreply.github.com>2020-05-27 20:30:38 (GMT)
committerGitHub <noreply@github.com>2020-05-27 20:30:38 (GMT)
commitc116c94ff119485761460f1033cdee425bed0310 (patch)
tree83d645e05d244b3692c004648a510691a4856a96 /Lib/test/test_ast.py
parentdb5aed931f8a617f7b63e773f62db468fe9c5ca1 (diff)
downloadcpython-c116c94ff119485761460f1033cdee425bed0310.zip
cpython-c116c94ff119485761460f1033cdee425bed0310.tar.gz
cpython-c116c94ff119485761460f1033cdee425bed0310.tar.bz2
bpo-40614: Respect feature version for f-string debug expressions (GH-20196)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 3e9c8b5..a3b366e 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -663,6 +663,11 @@ class AST_Tests(unittest.TestCase):
expressions[0] = f"expr = {ast.expr.__subclasses__()[0].__doc__}"
self.assertCountEqual(ast.expr.__doc__.split("\n"), expressions)
+ def test_issue40614_feature_version(self):
+ ast.parse('f"{x=}"', feature_version=(3, 8))
+ with self.assertRaises(SyntaxError):
+ ast.parse('f"{x=}"', feature_version=(3, 7))
+
class ASTHelpers_Test(unittest.TestCase):
maxDiff = None