Test that something is expected to fail actually fails
Estimated time: 10 min
time_range may still work when end_time is before start_time, but that may make overlap_time not working as expected.
Ensure that your main code stops this. Modify time_range to produce an error (ValueError) with a meaningful message when a "backwards" time_range is passed to it - this is called input validation.
Write a test that tries to generate a time range for a date going backwards.
Use pytest.raises to check for that error in the test.
Commit, push and link to this issue (including Answers UCL-COMP0233-22-23/RSE-Classwork#20).
Test that something is expected to fail actually fails
Estimated time: 10 min
time_range
may still work whenend_time
is beforestart_time
, but that may makeoverlap_time
not working as expected.time_range
to produce an error (ValueError
) with a meaningful message when a "backwards"time_range
is passed to it - this is called input validation.pytest.raises
to check for that error in the test.Answers UCL-COMP0233-22-23/RSE-Classwork#20
).What other similar tests could we add?
Sample solution