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
{{ message }}
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
Negative tests - Test that invalid inputs fail meaningfully and as expected
time_range may still work when t1 is before t0, but that may cause compute_overlap to work in unexpected ways.
Your job is to ensure calling time_range with an invalid input stops the code execution with a good error message for the user. This is an example of a "negative test".
Write a test that tries to generate a time range for a date going backwards.
Modify time_range to produce an error (ValueError) with a meaningful message.
You can do this using the line raise ValueError("<message here>")
Use pytest.raises (See its documentation) to check that the code raises the expected error and error message.
Commit, push and link to this issue, as you've done with the exercises.
What other similar tests could we add?
The text was updated successfully, but these errors were encountered:
Negative tests - Test that invalid inputs fail meaningfully and as expected
time_range
may still work whent1
is beforet0
, but that may causecompute_overlap
to work in unexpected ways.Your job is to ensure calling
time_range
with an invalid input stops the code execution with a good error message for the user. This is an example of a "negative test".time_range
to produce an error (ValueError
) with a meaningful message.raise ValueError("<message here>")
pytest.raises
(See its documentation) to check that the code raises the expected error and error message.What other similar tests could we add?
The text was updated successfully, but these errors were encountered: