summaryrefslogtreecommitdiff
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-05-27 22:01:11 +0100
committerGitHub <noreply@github.com>2020-05-27 22:01:11 +0100
commit9b83829e7d476acecc86d48978acc5813ec51e65 (patch)
tree54ed63c5cb7e0d81cd1ea91bf51f935a66658bbd /Lib/test/test_ast.py
parent3a2667d91e33493ccde113ddf5092afefc3c89fa (diff)
downloadcpython-git-9b83829e7d476acecc86d48978acc5813ec51e65.tar.gz
[3.9] bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20464)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com> (cherry picked from commit c116c94) Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.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 3e9c8b55cd..a3b366ec35 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