Add annotationlib,ann_module from 3.14.2

also partially update test_module
This commit is contained in:
Jeong, YunWon
2026-01-16 00:36:21 +09:00
parent 566b6f438b
commit dc93614f5a
3 changed files with 1148 additions and 5 deletions

1143
Lib/annotationlib.py vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -334,7 +334,11 @@ a = A(destroyed)"""
del foo.__annotations__
def test_annotations_are_created_correctly(self):
ann_module4 = import_helper.import_fresh_module('test.typinganndata.ann_module4')
ann_module4 = import_helper.import_fresh_module(
'test.typinganndata.ann_module4',
)
self.assertFalse("__annotations__" in ann_module4.__dict__)
self.assertEqual(ann_module4.__annotations__, {"a": int, "b": str})
self.assertTrue("__annotations__" in ann_module4.__dict__)
del ann_module4.__annotations__
self.assertFalse("__annotations__" in ann_module4.__dict__)

View File

@@ -8,8 +8,6 @@ Empty lines above are for good reason (testing for correct line numbers)
from typing import Optional
from functools import wraps
__annotations__[1] = 2
class C:
x = 5; y: Optional['C'] = None
@@ -18,8 +16,6 @@ from typing import Tuple
x: int = 5; y: str = x; f: Tuple[int, int]
class M(type):
__annotations__['123'] = 123
o: type = object
(pars): bool = True