Skip to content

Commit

Permalink
tests: test_noclass_iterable/test_noclass_noniterable
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Oct 2, 2020
1 parent 3e50f9b commit afa9cd0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions testing/python/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,19 @@ def test_division(example_input, expectation):
result = testdir.runpytest()
result.stdout.fnmatch_lines(["*2 failed*"])

def test_noclass(self):
with pytest.raises(TypeError):
pytest.raises("wrong", lambda: None)
def test_noclass_iterable(self) -> None:
with pytest.raises(
TypeError,
match="^exceptions must be derived from BaseException, not <class 'str'>$",
):
pytest.raises("wrong", lambda: None) # type: ignore[call-overload]

def test_noclass_noniterable(self) -> None:
with pytest.raises(
TypeError,
match="^exceptions must be derived from BaseException, not <class 'int'>$",
):
pytest.raises(41, lambda: None) # type: ignore[call-overload]

def test_invalid_arguments_to_raises(self):
with pytest.raises(TypeError, match="unknown"):
Expand Down

0 comments on commit afa9cd0

Please sign in to comment.