]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)
authorNikita Sobolev <mail@sobolevn.me>
Tue, 18 Jan 2022 14:43:51 +0000 (17:43 +0300)
committerGitHub <noreply@github.com>
Tue, 18 Jan 2022 14:43:51 +0000 (22:43 +0800)
Lib/test/test_typing.py

index c8a077e2f1ff553bb2bf3bc0cbae73f989145b0b..97c2c7f56cecb2766129c456a90f0d5195c38637 100644 (file)
@@ -4609,6 +4609,10 @@ class AnnotatedTests(BaseTestCase):
         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, ...],