improve pytest.raises

This commit is contained in:
Babak Keyvani
2022-04-30 17:56:36 -06:00
parent e580534df0
commit 3444d35c54
4 changed files with 14 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ class TestRaises:
excinfo = pytest.raises(ValueError, int, "hello")
assert "invalid literal" in str(excinfo.value)
def test_raises_does_not_allow_empty_tuple(self):
with pytest.raises(ValueError):
pytest.raises(expected_exception=())
def test_raises_callable_no_exception(self) -> None:
class A:
def __call__(self):