Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e63066c

Browse files
authored
bpo-46299: improve test_descr.py with stricter error handling (GH-30471)
1 parent ad1d590 commit e63066c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/test/test_descr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,10 +2545,8 @@ def getdict(self):
25452545
m2instance.b = 2
25462546
m2instance.a = 1
25472547
self.assertEqual(m2instance.__dict__, "Not a dict!")
2548-
try:
2548+
with self.assertRaises(TypeError):
25492549
dir(m2instance)
2550-
except TypeError:
2551-
pass
25522550

25532551
# Two essentially featureless objects, (Ellipsis just inherits stuff
25542552
# from object.
@@ -4066,7 +4064,7 @@ class D(C):
40664064
except TypeError:
40674065
pass
40684066
else:
4069-
assert 0, "best_base calculation found wanting"
4067+
self.fail("best_base calculation found wanting")
40704068

40714069
def test_unsubclassable_types(self):
40724070
with self.assertRaises(TypeError):
@@ -4452,6 +4450,8 @@ def __getattr__(self, attr):
44524450
print("Oops!")
44534451
except RuntimeError:
44544452
pass
4453+
else:
4454+
self.fail("Didn't raise RuntimeError")
44554455
finally:
44564456
sys.stdout = test_stdout
44574457

0 commit comments

Comments
 (0)