mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
GH-96073: Fix wild replacement in inspect.formatannotation (#96074)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
676d8ef380
commit
d5fea01d9d
5 changed files with 26 additions and 1 deletions
|
@ -1421,6 +1421,13 @@ class TestClassesAndFunctions(unittest.TestCase):
|
|||
self.assertEqual(inspect.get_annotations(isa.MyClassWithLocalAnnotations, eval_str=True), {'x': int})
|
||||
|
||||
|
||||
class TestFormatAnnotation(unittest.TestCase):
|
||||
def test_typing_replacement(self):
|
||||
from test.typinganndata.ann_module9 import ann, ann1
|
||||
self.assertEqual(inspect.formatannotation(ann), 'Union[List[str], int]')
|
||||
self.assertEqual(inspect.formatannotation(ann1), 'Union[List[testModule.typing.A], int]')
|
||||
|
||||
|
||||
class TestIsDataDescriptor(unittest.TestCase):
|
||||
|
||||
def test_custom_descriptors(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue