Extract import functionality
Improve doctest expectation messages