From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 19 Jan 2022 15:59:46 +0000 (-0800) Subject: [3.9] bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663... X-Git-Tag: v3.9.11~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=331378dffc334c1f05ab3152c87f46cd9155e169;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663) (GH-30692) (cherry picked from commit 32398294fb3fcf4ee74da54722fd0221c4e6cb74) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 8cdb1166c847..cb6be2cee87d 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -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, ...],