Testing

In this chapter, we'll look at the following recipes:

  • Using docstrings for testing
  • Testing functions that raise exceptions
  • Handling common doctest issues
  • Creating separate test modules and packages
  • Combining unittest and doctest tests
  • Testing things that involve dates or times
  • Testing things that involve randomness
  • Mocking external resources

Get Modern Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.