]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
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:54:07 +0000 (07:54 -0800)
committerGitHub <noreply@github.com>
Wed, 19 Jan 2022 15:54:07 +0000 (07:54 -0800)
(cherry picked from commit 32398294fb3fcf4ee74da54722fd0221c4e6cb74)

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

index f943aed73614cdf6287a403ab7b0a535b723f08a..b886c38827f1ff03b0f4a8c94c3578b18bbcb4f5 100644 (file)
@@ -4512,6 +4512,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, ...],