diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2025-04-15 17:14:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-15 17:14:27 (GMT) |
commit | 666eeda13d319aa82b151eef3e3c55a48d90a052 (patch) | |
tree | 7ae8857cde0fa13b86e1f4d101d8d6f731e60b37 /Lib/test | |
parent | 818b6a9eadb7c606bc3faab91de4a76bde66a9ae (diff) | |
download | cpython-666eeda13d319aa82b151eef3e3c55a48d90a052.zip cpython-666eeda13d319aa82b151eef3e3c55a48d90a052.tar.gz cpython-666eeda13d319aa82b151eef3e3c55a48d90a052.tar.bz2 |
gh-132493: Support deferred annotations in Protocols (#132494)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_typing.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 9f9e3eb..fc89380 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -4554,6 +4554,15 @@ class ProtocolTests(BaseTestCase): ) self.assertIs(type(exc.__cause__), CustomError) + def test_deferred_evaluation_of_annotations(self): + class DeferredProto(Protocol): + x: DoesNotExist + self.assertEqual(get_protocol_members(DeferredProto), {"x"}) + self.assertEqual( + annotationlib.get_annotations(DeferredProto, format=annotationlib.Format.STRING), + {'x': 'DoesNotExist'} + ) + class GenericTests(BaseTestCase): |