diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-07-07 23:42:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-07 13:42:40 -0700 |
commit | 6e6a4cd52332017b10c8d88fbbbfe015948093f4 (patch) | |
tree | 94e358a6886d827fdeea2fdece4f74573f23af35 /Lib/test/test_abc.py | |
parent | 80b9b3a51757ebb1e3547afc349a229706eadfde (diff) | |
download | cpython-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.py | 5 |
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): |