[Python-checkins] bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821)

Fidget-Spinner webhook-mailer at python.org
Tue Feb 1 04:59:00 EST 2022


https://github.com/python/cpython/commit/4c0612ad00ba45dbea2a86f7db6d21546cf243f8
commit: 4c0612ad00ba45dbea2a86f7db6d21546cf243f8
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: Fidget-Spinner <28750310+Fidget-Spinner at users.noreply.github.com>
date: 2022-02-01T17:58:41+08:00
summary:

bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821)

files:
M Lib/test/test_typing.py

diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 8449affd03a76..090d4c70d3d84 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]),



More information about the Python-checkins mailing list