summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorIvan Levkivskyi <levkivskyi@gmail.com>2019-05-26 23:54:13 (GMT)
committerGitHub <noreply@github.com>2019-05-26 23:54:13 (GMT)
commit2f0bfd27a5e3a9a7cbeb2ddd45ce50c3d4bdb4e9 (patch)
tree8b6d429d020e74ec30a6686039de5cee654a2e88 /Lib
parentb821868e6d909f4805499db519ebc2cdc01cf611 (diff)
downloadcpython-2f0bfd27a5e3a9a7cbeb2ddd45ce50c3d4bdb4e9.zip
cpython-2f0bfd27a5e3a9a7cbeb2ddd45ce50c3d4bdb4e9.tar.gz
cpython-2f0bfd27a5e3a9a7cbeb2ddd45ce50c3d4bdb4e9.tar.bz2
Add one more test for typing.Final (GH-13588)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_typing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 088db9c..46b7621 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