BUG: fix import issue with ``python -OO`` (stripping docstrings).

Docstring formatting at top-level leads to failed import when Python is run
with ``-OO``.
BUG: fix all issues found when running test suite with ``python -OO``.

Closes gh-2952.