mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-46299: improve test_descr.py with stricter error handling (GH-30471)
(cherry picked from commit e63066cfed)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
bea3f42bb7
commit
d2245cf190
1 changed files with 4 additions and 4 deletions
|
|
@ -2545,10 +2545,8 @@ def getdict(self):
|
||||||
m2instance.b = 2
|
m2instance.b = 2
|
||||||
m2instance.a = 1
|
m2instance.a = 1
|
||||||
self.assertEqual(m2instance.__dict__, "Not a dict!")
|
self.assertEqual(m2instance.__dict__, "Not a dict!")
|
||||||
try:
|
with self.assertRaises(TypeError):
|
||||||
dir(m2instance)
|
dir(m2instance)
|
||||||
except TypeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Two essentially featureless objects, (Ellipsis just inherits stuff
|
# Two essentially featureless objects, (Ellipsis just inherits stuff
|
||||||
# from object.
|
# from object.
|
||||||
|
|
@ -4062,7 +4060,7 @@ class D(C):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
assert 0, "best_base calculation found wanting"
|
self.fail("best_base calculation found wanting")
|
||||||
|
|
||||||
def test_unsubclassable_types(self):
|
def test_unsubclassable_types(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
|
|
@ -4448,6 +4446,8 @@ def __getattr__(self, attr):
|
||||||
print("Oops!")
|
print("Oops!")
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
self.fail("Didn't raise RuntimeError")
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = test_stdout
|
sys.stdout = test_stdout
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue