Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f0bfd2

Browse files
authored
Add one more test for typing.Final (GH-13588)
1 parent b821868 commit 2f0bfd2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_typing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,11 @@ def test_default_globals(self):
17721772
hints = get_type_hints(ns['C'].foo)
17731773
self.assertEqual(hints, {'a': ns['C'], 'return': ns['D']})
17741774

1775+
def test_final_forward_ref(self):
1776+
self.assertEqual(gth(Loop, globals())['attr'], Final[Loop])
1777+
self.assertNotEqual(gth(Loop, globals())['attr'], Final[int])
1778+
self.assertNotEqual(gth(Loop, globals())['attr'], Final)
1779+
17751780

17761781
class OverloadTests(BaseTestCase):
17771782

@@ -1858,6 +1863,9 @@ class CSub(B):
18581863
class G(Generic[T]):
18591864
lst: ClassVar[List[T]] = []
18601865

1866+
class Loop:
1867+
attr: Final['Loop']
1868+
18611869
class NoneAndForward:
18621870
parent: 'NoneAndForward'
18631871
meaning: None

0 commit comments

Comments
 (0)