Change some doctest examples into unit tests.