try/else on 2.6 fixup

This commit is contained in:
rocky
2018-01-07 21:24:35 -05:00
parent 7db8001d54
commit fbda3ca695
10 changed files with 59 additions and 19 deletions

View File

@@ -0,0 +1,17 @@
# From 2.4 test_binop.py bug is missing 'else:' in 2nd try.
def test_constructor():
for bad in "0", 0.0, 0j, (), [], {}, None:
try:
raise TypeError(bad)
except TypeError:
pass
else:
assert False, "%r didn't raise TypeError" % bad
try:
raise TypeError(bad)
except TypeError:
pass
else:
assert False, "%r didn't raise TypeError" % bad
test_constructor()