PyTest - Writing Assertions
How can you assert that a function
foo() raises a ValueError using PyTest's assert mechanism?foo() raises a ValueError using PyTest's assert mechanism?with pytest.raises(ExceptionType): to check exceptions.with pytest.raises(ValueError): foo() uses correct syntax; others are invalid Python.with pytest.raises(ValueError): foo() -> Option D15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions