Fix broken tests and refactor enabled doctests into Python-based tests

Includes Steven's work to enable behavior for p.a.contenttypes.