From 4c0612ad00ba45dbea2a86f7db6d21546cf243f8 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 1 Feb 2022 12:58:41 +0300 Subject: [PATCH] bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821) --- Lib/test/test_typing.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 8449affd03a..090d4c70d3d 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -4643,6 +4643,13 @@ class A(typing.Match): 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]),