summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-08 05:26:01 (GMT)
committerGitHub <noreply@github.com>2022-01-08 05:26:01 (GMT)
commitd2245cf190c36a6d74fe947bf133ce09d3313a6f (patch)
tree9640e2537bb1c311532e679ffe33bde7bedea75b /Lib/test
parentbea3f42bb7c360921f864949ef7472a7ecb02cd3 (diff)
downloadcpython-d2245cf190c36a6d74fe947bf133ce09d3313a6f.zip
cpython-d2245cf190c36a6d74fe947bf133ce09d3313a6f.tar.gz
cpython-d2245cf190c36a6d74fe947bf133ce09d3313a6f.tar.bz2
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
(cherry picked from commit e63066cfed27511c9b786d61761f87f7a532571a) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_descr.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 3df69ba..f3dd1b3 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.
@@ -4062,7 +4060,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):
@@ -4448,6 +4446,8 @@ order (MRO) for bases """
print("Oops!")
except RuntimeError:
pass
+ else:
+ self.fail("Didn't raise RuntimeError")
finally:
sys.stdout = test_stdout