From: Ivan Levkivskyi Date: Sun, 26 May 2019 23:54:13 +0000 (+0100) Subject: Add one more test for typing.Final (GH-13588) X-Git-Tag: v3.8.0b1~198 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f0bfd27a5e3a9a7cbeb2ddd45ce50c3d4bdb4e9;p=python Add one more test for typing.Final (GH-13588) --- diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 088db9c012..46b7621182 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -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