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

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

index e5b596e7f3d82240660d21ca8367b2c20386366e..366f7d8eb31d1800e96518cf339dad9d515b73a8 100644 (file)
@@ -4543,6 +4543,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]),