Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Passing Unit Tests

This is very important

To date, we have been using input/output tests. From now on we will be mainly using unit tests that import functions from your files.

These allow us to test individual functions. We will discuss this properly later on in the module.

There are two main points here:

  1. You should only write code in either a function block. e.g. the add() function.
  2. You should write all other code that runs your program and calls the functions in the if __name__ == "__main__" block.

Any code outside of this can cause problems with the tests!