Update pytest.raises to raise a TypeError when an invalid keyword argument is passed.
This commit is contained in:
@@ -61,6 +61,11 @@ class TestRaises(object):
|
||||
with pytest.raises(TypeError):
|
||||
pytest.raises('wrong', lambda: None)
|
||||
|
||||
def test_invalid_arguments_to_raises(self):
|
||||
with pytest.raises(TypeError, match='unknown'):
|
||||
with pytest.raises(TypeError, unknown='bogus'):
|
||||
raise ValueError()
|
||||
|
||||
def test_tuple(self):
|
||||
with pytest.raises((KeyError, ValueError)):
|
||||
raise KeyError('oops')
|
||||
|
||||
Reference in New Issue
Block a user