Skip to content

[WIP] Add do_not_raise #4043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Javier Romero
Jeff Rackauckas
Jeff Widman
Jenni Rinker
Joan Massich
John Eddie Ayson
John Towler
Jon Sonesen
Expand Down
10 changes: 10 additions & 0 deletions testing/python/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ def test_no_raise_message(self):
else:
assert False, "Expected pytest.raises.Exception"

@pytest.mark.parametrize('example_input,expectation', [
(3, do_not_raise),
(2, do_not_raise),
(1, do_not_raise),
(0, raises(ZeroDivisionError))])
def test_do_not_raise(example_input, expectation):
"""Test do_not_raise."""
with expectation:
assert (6 / example_input) is not None

def test_custom_raise_message(self):
message = "TEST_MESSAGE"
try:
Expand Down