Assignment #08: Exceptions and Testing

Assignment #08: Exceptions and Testing#

In today’s assignment we will revisit old code in order to properly test it and make it more robust.

Exercise #08-01: Refactor and test old code#

Select three of our previous assignment exercises and

  • write a test suite for each of them (i.e., one test_*.py file per module). The test suite must contain unit tests for each function you programmed. While doing so, you might find it very useful to refactor your code following the good practices: write small functions with a task clearly defined for which you can test. If you cannot test it, the function is possibly not written the right way: either too broad, or not useful enough. Also, try to include integration tests.

  • apply some of the exception handling methods covered in the Exceptions chapter. Add a test to your test suite to verify that exceptions are actually raised when they are supposed to.