[Python-checkins] bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)

Fidget-Spinner webhook-mailer at python.org
Tue Jan 18 09:44:17 EST 2022


https://github.com/python/cpython/commit/32398294fb3fcf4ee74da54722fd0221c4e6cb74
commit: 32398294fb3fcf4ee74da54722fd0221c4e6cb74
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: Fidget-Spinner <28750310+Fidget-Spinner at users.noreply.github.com>
date: 2022-01-18T22:43:51+08:00
summary:

bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)

files:
M Lib/test/test_typing.py

diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index c8a077e2f1ff5..97c2c7f56cecb 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4609,6 +4609,10 @@ def test_cannot_check_subclass(self):
         with self.assertRaises(TypeError):
             issubclass(int, Annotated[int, "positive"])
 
+    def test_too_few_type_args(self):
+        with self.assertRaisesRegex(TypeError, 'at least two arguments'):
+            Annotated[int]
+
     def test_pickle(self):
         samples = [typing.Any, typing.Union[int, str],
                    typing.Optional[str], Tuple[int, ...],



More information about the Python-checkins mailing list