Lecture 4.1: Python assignment and unit testing
This lecture introduces the python assignment and reviews unit testing in python.
This week is the final week of python. The focus is on unit testing in preparation for the python assignment. Unit tests allow us to write code that acts as a specification for how other code should behave. With unit tests, we can automatically test whether our code produces given outputs when given certain inputs. This not only allows us to know whether code is working, it also highlights places where we introduce bugs.
This lecture introduces the python assignment and reviews unit testing in python.
Unit tests allow us to create a specification for functions and to test whether the function does what we want it to do under various circumstances. For example, we can put different data into a function and confirm that the output is what we want.