-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Bug in assert_raise_message #4559
Copy link
Copy link
Closed
Labels
BugEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve
Description
If the function passed to assert_raise_message raises a different kind of error than expected, this error is not caught, i.e. the original error is raised.
Example
def f():
raise ValueError("That's how you get ants")
assert_raise_message(TypeError, "wrong type", f)will raise "ValueError 'That's how you get ants'" when it should raise "AssertionError, f didn't raise TypeError".
On the other hand, assert_raises_regex behaves correctly. So I think instead of fixing the bug, we should just trash "assert_raise_message" and use the standard function instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve