This exercise will look at understanding what a given python function (times.py) does, and writing a test to check that it works as expected.
Fork the time-tests repository and clone it on your computer.
Read the description of the exercise in the README file.
Start by reading the code in times.py, understanding what it does, and running it (before making any modifications to it).
The next step consists of converting the __main__ part of the code into a unit test.
Check that your test passes by running pytest.
When you are happy with your solution (or want some feedback!):
Push your new code to your own fork.
On GitHub, open a pull request from your fork to the original repository.
In the description, include the text Answers UCL-COMP0233-24-25/RSE-Classwork#11. This will list your PR to this issue.
On the PR text, comment on what you found difficult or interesting, or something you learned.
Choose one of the other pull requests listed on this issue, and leave a review. Comment on things you find interesting or don't understand, any problems you think you spot, good solutions, or potential improvements.
Think about what other aspects of times.py should be tested and report them on the Moodle questionnaire.
If you have questions or get stuck, ask on Moodle or book an office hours slot!
This exercise will look at understanding what a given python function (
times.py
) does, and writing a test to check that it works as expected.times.py
, understanding what it does, and running it (before making any modifications to it).__main__
part of the code into a unit test.pytest
.Answers UCL-COMP0233-24-25/RSE-Classwork#11
. This will list your PR to this issue.times.py
should be tested and report them on the Moodle questionnaire.If you have questions or get stuck, ask on Moodle or book an office hours slot!
Sample solution