You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for these level-up webinars! I have a question regarding the example test you constructed for the view() function: test_view_bad_dayofyear(). You discovered that setting a day of year to 1000 raises an IndexError. You then added with pytest.raises(IndexError) to the test and the test passes. So the test checks that the code raises a proper error - is the correct way to think of this test? My tendency then would be to take this one step further and trap for that error in the view function to warn the user? Is that a proper response to the unit testing?
The text was updated successfully, but these errors were encountered:
Thanks for these level-up webinars! I have a question regarding the example test you constructed for the view() function: test_view_bad_dayofyear(). You discovered that setting a day of year to 1000 raises an IndexError. You then added
with pytest.raises(IndexError)
to the test and the test passes. So the test checks that the code raises a proper error - is the correct way to think of this test? My tendency then would be to take this one step further and trap for that error in the view function to warn the user? Is that a proper response to the unit testing?The text was updated successfully, but these errors were encountered: