From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:25:25 +0000 (-0800) Subject: [3.9] bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821) (GH-31045) X-Git-Tag: v3.9.11~109 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2532b7c820ec2dc87b19eb322ab92b47f3c77866;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821) (GH-31045) (cherry picked from commit 4c0612ad00ba45dbea2a86f7db6d21546cf243f8) Co-authored-by: Nikita Sobolev Automerge-Triggered-By: GH:Fidget-Spinner --- diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index dfca96b90993..27ec5edd92b7 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -4158,6 +4158,13 @@ class RETests(BaseTestCase): class AnnotatedTests(BaseTestCase): + def test_new(self): + with self.assertRaisesRegex( + TypeError, + 'Type Annotated cannot be instantiated', + ): + Annotated() + def test_repr(self): self.assertEqual( repr(Annotated[int, 4, 5]),