Chapter 3. Unit Testing with doctest

In the last chapter, we talked about what doctest does, how it works, and what you can expect out of it. Why are we devoting another chapter to it?

We're not. This chapter isn't really about doctest. It's about the testing discipline called unit testing. Since unit testing is an idea, not a piece of software, we'll be using doctest to practice with it.

In this chapter, we're going to see:

  • What unit testing actually is
  • How unit testing helps
  • How doctest relates to unit testing

What is unit testing?

First of all, why do we care what unit testing is? One answer is that unit testing is a best practice that has been evolving toward its current form over most of the time that programming has existed. Another answer is that ...

Get Learning Python Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.