Doctests are strings embedded in Python code that resemble interactive sessions. These strings can be used to test certain assumptions or just to provide examples. The numpy.testing module has a function to run these tests.
numpy.testing