]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821) (GH-31045)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 1 Feb 2022 10:25:25 +0000 (02:25 -0800)
committerGitHub <noreply@github.com>
Tue, 1 Feb 2022 10:25:25 +0000 (02:25 -0800)
(cherry picked from commit 4c0612ad00ba45dbea2a86f7db6d21546cf243f8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Automerge-Triggered-By: GH:Fidget-Spinner
Lib/test/test_typing.py

index dfca96b90993222bb297afe79c0532b43a67e0b8..27ec5edd92b7af70f1d7807998ef1453ab00d411 100644 (file)
@@ -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]),