[Python-checkins] Use more precise exception types in `assertRaises` in typing tests (#98650)

JelleZijlstra webhook-mailer at python.org
Tue Oct 25 09:33:40 EDT 2022


https://github.com/python/cpython/commit/45c89358b71e4638455e75ba6e60b42c511bbc2a
commit: 45c89358b71e4638455e75ba6e60b42c511bbc2a
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2022-10-25T06:33:34-07:00
summary:

Use more precise exception types in `assertRaises` in typing tests (#98650)

files:
M Lib/test/test_typing.py

diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index ab8e71735c4d..26c3e0294ce6 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3575,11 +3575,11 @@ class D(C):
 
         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):



More information about the Python-checkins mailing list