SECTION 43 / 48

Testing Expected Exceptions

1 min read

Add 10 items and attempt to delete 20. A test using pytest.raises(ValueError) passes when ValueError is raised. If the test deletes only 5, the expected exception is not raised and that test fails.

Testing Expected Exceptions
Testing Expected Exceptions
Open image ↗
Testing Expected Exceptions
YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑