diff options
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_ast.py | 12 | ||||
| -rw-r--r-- | Lib/test/test_type_comments.py | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 3789ac2..d49c149 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -1045,19 +1045,15 @@ class AST_Tests(unittest.TestCase): with self.assertRaises(SyntaxError): ast.parse('lambda x=1, /: ...', feature_version=(3, 7)) - def test_parenthesized_with_feature_version(self): - ast.parse('with (CtxManager() as example): ...', feature_version=(3, 10)) - # While advertised as a feature in Python 3.10, this was allowed starting 3.9 - ast.parse('with (CtxManager() as example): ...', feature_version=(3, 9)) - with self.assertRaises(SyntaxError): - ast.parse('with (CtxManager() as example): ...', feature_version=(3, 8)) - ast.parse('with CtxManager() as example: ...', feature_version=(3, 8)) - def test_assignment_expression_feature_version(self): ast.parse('(x := 0)', feature_version=(3, 8)) with self.assertRaises(SyntaxError): ast.parse('(x := 0)', feature_version=(3, 7)) + def test_conditional_context_managers_parse_with_low_feature_version(self): + # regression test for gh-115881 + ast.parse('with (x() if y else z()): ...', feature_version=(3, 8)) + def test_exception_groups_feature_version(self): code = dedent(''' try: ... diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py index 5a911da..ee8939f 100644 --- a/Lib/test/test_type_comments.py +++ b/Lib/test/test_type_comments.py @@ -309,7 +309,7 @@ class TypeCommentTests(unittest.TestCase): self.assertEqual(tree.body[0].type_comment, None) def test_parenthesized_withstmt(self): - for tree in self.parse_all(parenthesized_withstmt, minver=9): + for tree in self.parse_all(parenthesized_withstmt): self.assertEqual(tree.body[0].type_comment, "int") self.assertEqual(tree.body[1].type_comment, "int") tree = self.classic_parse(parenthesized_withstmt) |
