Refactor doctests to be valid on Travis