]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use more precise exception types in `assertRaises` in typing tests (GH-98650)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 25 Oct 2022 14:12:59 +0000 (07:12 -0700)
committerGitHub <noreply@github.com>
Tue, 25 Oct 2022 14:12:59 +0000 (07:12 -0700)
(cherry picked from commit 45c89358b71e4638455e75ba6e60b42c511bbc2a)

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

index 3f38e30881d4d4552c99195e1827e3f067965176..34f944416070cd5951c9dc67bf7071681bf2516a 100644 (file)
@@ -2405,11 +2405,11 @@ class GenericTests(BaseTestCase):
 
         self.assertEqual(D.__parameters__, ())
 
-        with self.assertRaises(Exception):
+        with self.assertRaises(TypeError):
             D[int]
-        with self.assertRaises(Exception):
+        with self.assertRaises(TypeError):
             D[Any]
-        with self.assertRaises(Exception):
+        with self.assertRaises(TypeError):
             D[T]
 
     def test_new_with_args(self):