diff options
author | Guido van Rossum <guido@python.org> | 2020-04-30 19:12:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 19:12:19 (GMT) |
commit | c001c09e9059ba04bc088349cd87a1374dc0754f (patch) | |
tree | 74603d5653001e6fd7f4c02e2ddaed2efbdfb5a4 /Lib | |
parent | efb8dd5b3ec91f7d9458d3f203d748604d52b121 (diff) | |
download | cpython-c001c09e9059ba04bc088349cd87a1374dc0754f.zip cpython-c001c09e9059ba04bc088349cd87a1374dc0754f.tar.gz cpython-c001c09e9059ba04bc088349cd87a1374dc0754f.tar.bz2 |
bpo-40334: Support type comments (GH-19780)
This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile().
Closes https://github.com/we-like-parsers/cpython/issues/95.
(For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.)
The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_type_comments.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py index ce3b798..6c3f6ed 100644 --- a/Lib/test/test_type_comments.py +++ b/Lib/test/test_type_comments.py @@ -219,7 +219,6 @@ def favk( """ -@support.skip_if_new_parser("Pegen does not support type comments yet") class TypeCommentTests(unittest.TestCase): lowest = 4 # Lowest minor version supported @@ -253,6 +252,7 @@ class TypeCommentTests(unittest.TestCase): self.assertEqual(tree.body[0].type_comment, None) self.assertEqual(tree.body[1].type_comment, None) + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_asyncdef(self): for tree in self.parse_all(asyncdef, minver=5): self.assertEqual(tree.body[0].type_comment, "() -> int") @@ -261,22 +261,27 @@ class TypeCommentTests(unittest.TestCase): self.assertEqual(tree.body[0].type_comment, None) self.assertEqual(tree.body[1].type_comment, None) + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_asyncvar(self): for tree in self.parse_all(asyncvar, maxver=6): pass + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_asynccomp(self): for tree in self.parse_all(asynccomp, minver=6): pass + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_matmul(self): for tree in self.parse_all(matmul, minver=5): pass + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_fstring(self): for tree in self.parse_all(fstring, minver=6): pass + @support.skip_if_new_parser("Pegen does not support feature_version yet") def test_underscorednumber(self): for tree in self.parse_all(underscorednumber, minver=6): pass |