1. Learn
  2. /
  3. Courses
  4. /
  5. Software Engineering Principles in Python

Exercise

Using doctest

We just learned about doctest, which, if you're writing full docstrings with examples, is a simple way to minimally test your functions. In this exercise, you'll get some hands-on practice testing and debugging with doctest.

The following have all be pre-loaded in your environment: doctest, Counter, and text_analyzer.

Note that your docstring submission must match the solution exactly. If you find yourself getting it wrong several times, it may be a good idea to refresh the sample code and start over.

Instructions

100 XP
  • Complete the input code of the example in the docstring for sum_counters.
  • Complete the docstring example by filling in the expected output.
  • Run the testmod function from doctest to test your function's example code.