diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 3df69ba1140..f3dd1b32e2a 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2545,10 +2545,8 @@ def getdict(self): 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. @@ -4062,7 +4060,7 @@ class D(C): 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): @@ -4448,6 +4446,8 @@ def __getattr__(self, attr): print("Oops!") except RuntimeError: pass + else: + self.fail("Didn't raise RuntimeError") finally: sys.stdout = test_stdout