mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Add annotationlib,ann_module from 3.14.2
also partially update test_module
This commit is contained in:
1143
Lib/annotationlib.py
vendored
Normal file
1143
Lib/annotationlib.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
Lib/test/test_module/__init__.py
vendored
6
Lib/test/test_module/__init__.py
vendored
@@ -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__)
|
||||
|
||||
4
Lib/test/typinganndata/ann_module.py
vendored
4
Lib/test/typinganndata/ann_module.py
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user