aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_abc.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-07-07 23:42:40 +0300
committerGitHub <noreply@github.com>2023-07-07 13:42:40 -0700
commit6e6a4cd52332017b10c8d88fbbbfe015948093f4 (patch)
tree94e358a6886d827fdeea2fdece4f74573f23af35 /Lib/test/test_abc.py
parent80b9b3a51757ebb1e3547afc349a229706eadfde (diff)
downloadcpython-6e6a4cd52332017b10c8d88fbbbfe015948093f4.tar.gz
cpython-6e6a4cd52332017b10c8d88fbbbfe015948093f4.zip
gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r--Lib/test/test_abc.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 86f31a9acb4..5ce57cc209e 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -448,15 +448,16 @@ def test_factory(abc_ABCMeta, abc_get_cache_token):
# Also check that issubclass() propagates exceptions raised by
# __subclasses__.
+ class CustomError(Exception): ...
exc_msg = "exception from __subclasses__"
def raise_exc():
- raise Exception(exc_msg)
+ raise CustomError(exc_msg)
class S(metaclass=abc_ABCMeta):
__subclasses__ = raise_exc
- with self.assertRaisesRegex(Exception, exc_msg):
+ with self.assertRaisesRegex(CustomError, exc_msg):
issubclass(int, S)
def test_subclasshook(self):