Time for action - testing PID with unittest
We'll revisit the PID class (or at least the tests for the PID class) from Chapter 3. We'll rewrite the tests so that they operate within the unittest framework.
Before moving on, take a moment to refer back to the final version of the
pid.txt file from Chapter 3. We'll be implementing the same tests using the unittest framework.
- Create a new file called
test_pid.pyin the same directory as
pid.py. Notice that this is a
.pyfile: unittest tests are pure python source code, rather than being plain text with source code embedded in it. That means the tests will be less useful from a documentary point of view, but grants other benefits in exchange.
- Insert the following code into your newly-created