Make doctest integration in unittest generic.

Rely on introspection rather than redundant typing.