[Python-checkins] bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
corona10
webhook-mailer at python.org
Fri Jan 7 22:51:56 EST 2022
https://github.com/python/cpython/commit/e63066cfed27511c9b786d61761f87f7a532571a
commit: e63066cfed27511c9b786d61761f87f7a532571a
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-01-08T12:51:51+09:00
summary:
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
files:
M Lib/test/test_descr.py
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index a4131bec602ea..e8ecacb5c4d76 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.
@@ -4066,7 +4064,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):
@@ -4452,6 +4450,8 @@ def __getattr__(self, attr):
print("Oops!")
except RuntimeError:
pass
+ else:
+ self.fail("Didn't raise RuntimeError")
finally:
sys.stdout = test_stdout
More information about the Python-checkins
mailing list