UCL-COMP0233-24-25 / RSE-Classwork

6 stars 85 forks source link

Writing a test for times.py #11

Open dpshelio opened 1 month ago

dpshelio commented 1 month ago

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.

  1. Fork the time-tests repository and clone it on your computer.
  2. Read the description of the exercise in the README file.
  3. Start by reading the code in times.py, understanding what it does, and running it (before making any modifications to it).
  4. The next step consists of converting the __main__ part of the code into a unit test.
  5. Check that your test passes by running pytest.
  6. When you are happy with your solution (or want some feedback!):
    1. Push your new code to your own fork.
    2. On GitHub, open a pull request from your fork to the original repository.
    3. In the description, include the text Answers UCL-COMP0233-24-25/RSE-Classwork#11. This will list your PR to this issue.
    4. On the PR text, comment on what you found difficult or interesting, or something you learned.
  7. 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.
  8. 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!


Sample solution