]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 19 Jan 2022 15:59:46 +0000 (07:59 -0800)
committerGitHub <noreply@github.com>
Wed, 19 Jan 2022 15:59:46 +0000 (07:59 -0800)
(cherry picked from commit 32398294fb3fcf4ee74da54722fd0221c4e6cb74)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Lib/test/test_typing.py

index 8cdb1166c847f7cc89b41ec80353459149226ed8..cb6be2cee87d7a5c710650f42a2e49363638ccf4 100644 (file)
@@ -4243,6 +4243,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, ...],