Why test?
More and more programmers are learning how important testing their code is. If you're among them, feel free to skim this section. You'll find the next section, where we actually learn how to do the tests in Python, more scintillating. If you're not convinced of the importance of testing, I promise that your code is broken, you just don't know it. Read on!
Some people argue that testing is more important in Python code because of its dynamic nature; compiled languages such as Java and C++ are occasionally thought to be somehow 'safer' because they enforce type checking at compile time. The thing is, Python tests rarely, if ever, check types. They're checking values. They're making sure that the right attributes have been set at the right time or that the sequence has the right length, order, and values. They aren't checking to make absolutely sure that a list was returned if a tuple or custom container would suffice. These higher-level things need to be tested in any language. The...