Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest example test_bad_dayofyear() #8

Open
rmcd-mscb opened this issue May 7, 2020 · 0 comments
Open

pytest example test_bad_dayofyear() #8

rmcd-mscb opened this issue May 7, 2020 · 0 comments

Comments

@rmcd-mscb
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant