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

miss-islington webhook-mailer at python.org
Tue Feb 1 05:25:43 EST 2022


https://github.com/python/cpython/commit/2532b7c820ec2dc87b19eb322ab92b47f3c77866
commit: 2532b7c820ec2dc87b19eb322ab92b47f3c77866
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-01T02:25:25-08:00
summary:

[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 <mail at sobolevn.me>

Automerge-Triggered-By: GH:Fidget-Spinner

files:
M Lib/test/test_typing.py

diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index dfca96b909932..27ec5edd92b7a 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4158,6 +4158,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