Commit 2f0bfd27 authored by Ivan Levkivskyi's avatar Ivan Levkivskyi Committed by GitHub

Add one more test for typing.Final (GH-13588)

parent b821868e
......@@ -1772,6 +1772,11 @@ class ForwardRefTests(BaseTestCase):
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment