mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
Add one more test for typing.Final (GH-13588)
This commit is contained in:
parent
b821868e6d
commit
2f0bfd27a5
1 changed files with 8 additions and 0 deletions
|
|
@ -1772,6 +1772,11 @@ def test_default_globals(self):
|
|||
hints = get_type_hints(ns['C'].foo)
|
||||
self.assertEqual(hints, {'a': ns['C'], 'return': ns['D']})
|
||||
|
||||
def test_final_forward_ref(self):
|
||||
self.assertEqual(gth(Loop, globals())['attr'], Final[Loop])
|
||||
self.assertNotEqual(gth(Loop, globals())['attr'], Final[int])
|
||||
self.assertNotEqual(gth(Loop, globals())['attr'], Final)
|
||||
|
||||
|
||||
class OverloadTests(BaseTestCase):
|
||||
|
||||
|
|
@ -1858,6 +1863,9 @@ class CSub(B):
|
|||
class G(Generic[T]):
|
||||
lst: ClassVar[List[T]] = []
|
||||
|
||||
class Loop:
|
||||
attr: Final['Loop']
|
||||
|
||||
class NoneAndForward:
|
||||
parent: 'NoneAndForward'
|
||||
meaning: None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue