mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-119180: Add annotationlib
module to support PEP 649 (#119891)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
64e221d7ad
commit
7b7b90d1ce
15 changed files with 1815 additions and 510 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
from test.support import check_syntax_error
|
||||
from test.support import import_helper
|
||||
import annotationlib
|
||||
import inspect
|
||||
import unittest
|
||||
import sys
|
||||
|
@ -459,7 +460,7 @@ class GrammarTests(unittest.TestCase):
|
|||
gns = {}; lns = {}
|
||||
exec("'docstring'\n"
|
||||
"x: int = 5\n", gns, lns)
|
||||
self.assertEqual(lns["__annotate__"](1), {'x': int})
|
||||
self.assertEqual(lns["__annotate__"](annotationlib.Format.VALUE), {'x': int})
|
||||
with self.assertRaises(KeyError):
|
||||
gns['__annotate__']
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue