See docstring.py for all the details. They're unsurprising: the module docstring, and all function, class and method docstrings are searched, with the exception of docstrings attached to objects with private names.
In addition, if
M.__test__ exists and "is true", it must be a
dict, and each entry maps a (string) name to a function object, class
object, or string. Function and class object docstrings found from
M.__test__ are searched even if the name is private, and
strings are searched directly as if they were docstrings. In output,
M.__test__ appears with name
<name of M>.__test__.K
Any classes found are recursively searched similarly, to test docstrings in
their contained methods and nested classes. While private names reached
from M's globals are skipped, all names reached from
M.__test__ are searched.
See About this document... for information on suggesting changes.