use an exception more consistent across python versions
This commit is contained in:
parent
d5c3265763
commit
03cb37b1eb
|
@ -28,17 +28,14 @@ def test_assert_with_explicit_message():
|
||||||
assert e.msg == 'hello'
|
assert e.msg == 'hello'
|
||||||
|
|
||||||
def test_assert_within_finally():
|
def test_assert_within_finally():
|
||||||
class A:
|
excinfo = py.test.raises(ZeroDivisionError, """
|
||||||
def f():
|
|
||||||
pass
|
|
||||||
excinfo = py.test.raises(TypeError, """
|
|
||||||
try:
|
try:
|
||||||
A().f()
|
1/0
|
||||||
finally:
|
finally:
|
||||||
i = 42
|
i = 42
|
||||||
""")
|
""")
|
||||||
s = excinfo.exconly()
|
s = excinfo.exconly()
|
||||||
assert s.find("takes no argument") != -1
|
assert py.std.re.search("division.+by zero", s) is not None
|
||||||
|
|
||||||
#def g():
|
#def g():
|
||||||
# A.f()
|
# A.f()
|
||||||
|
|
Loading…
Reference in New Issue