diff options
| author | Nikita Sobolev <mail@sobolevn.me> | 2022-01-08 06:51:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-08 12:51:51 +0900 |
| commit | e63066cfed27511c9b786d61761f87f7a532571a (patch) | |
| tree | fe2b82ddf1ebd6ab926992b9a5a55afa51f68b8b | |
| parent | ad1d5908ada171eff768291371a80022bfad4f04 (diff) | |
| download | cpython-git-e63066cfed27511c9b786d61761f87f7a532571a.tar.gz | |
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
| -rw-r--r-- | Lib/test/test_descr.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index a4131bec60..e8ecacb5c4 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2545,10 +2545,8 @@ order (MRO) for bases """ m2instance.b = 2 m2instance.a = 1 self.assertEqual(m2instance.__dict__, "Not a dict!") - try: + with self.assertRaises(TypeError): dir(m2instance) - except TypeError: - pass # Two essentially featureless objects, (Ellipsis just inherits stuff # from object. @@ -4066,7 +4064,7 @@ order (MRO) for bases """ except TypeError: pass else: - assert 0, "best_base calculation found wanting" + self.fail("best_base calculation found wanting") def test_unsubclassable_types(self): with self.assertRaises(TypeError): @@ -4452,6 +4450,8 @@ order (MRO) for bases """ print("Oops!") except RuntimeError: pass + else: + self.fail("Didn't raise RuntimeError") finally: sys.stdout = test_stdout |
