Summary
In this chapter, we've looked at several features of polished and complete Python projects. The most important feature of working code is a suite of unit tests that demonstrate that the code works. Code without test cases simply cannot be trusted. In order to make use of any software, we must have tests that show us that the software is trustworthy.
We've looked at including tests in docstrings. The doctest
tool can locate these tests and execute them. We've looked at creating unittest.TestCase
classes. We can combine the two into a script that will locate all doctest
and unittest
test cases into a single master test suite.
One other feature of good software is some explanation of how to install and use the software. This may be as short as a README
file that provides basic information. Often, however, we need a more sophisticated document that provides a variety of additional information. We might want to provide context, design background, or examples that are too...