doctests are a great means of testing because they can better describe the code they are testing, with examples and comments in a very natural way for programmers.
However, Python editors are short of support for the crucial task of writing them; that is to say we lack auto-complete, Python syntax help, access to methods' docstrings, and so on. As a sad result, writing doctests is a pain in the neck.
Fortunately, iPython comes to the rescue with a special (and very nice, indeed) doctest compatibility mode:
In : %doctest_mode *** Pasting of code with ">>>" or "..." has been enabled. Exception reporting mode: Plain Doctest mode is: ON >>>
When entering in doctest_mode, the regular iPython prompts ...