Assignment #07: exceptions and testing

This week you have learned two important new concepts: unit testing and exceptions handling. In today's assignment we will revisit old code in order to properly test it and make it more robust.

Exercise #07-01: refactor and test old code

  • Write a test suite for the following past exercises: "#02: cryptography" and "#03: automated data download" (one test_*.py file per module). The test suite must contain unit tests for each function you programmed (I myself wrote 4 functions for exercise #02 and 3 for exercise #03). 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, which you can test for. If you can't test it, the function is possibly not written the right way: either too broad, or not useful enough.
  • Apply the exception handling methods learned in lesson 18 to the download function(s) of exercise #03. Add a test to your test suite to verify that exceptions are raised when an invalid tile is requested for download.

Back to the table of contents