[IPython-user] doctests

belinda thom bthom at cs.hmc.edu
Tue Jan 2 02:19:47 CST 2007


Hello,

I was hoping I might be able to run doctest scripts from w/in  
ipython, but it appears to not be possible.

In particular, I get the following kinds of errors w/in ipython  
(which don't show up when using python):

Trying:
     t.name()
Expecting:
     'Tic-Tac-Toe 3-by-3 wins comprised of 3 contiguous pieces'
Out[63]: 'Tic-Tac-Toe 3-by-3 wins comprised of 3 contiguous pieces'

It seems the main problem is the "Out[63]:" header. Is there a way to  
strip these off these output prompts just for the period that such  
tests are running?

I've tried this using both the magic run and calling directly from  
the cmd line (e.g. importing and then calling the "do_test" function  
in a __name__ == __main__ block; both yield the same behavior.

Any insight you might have appreciated (or if you've got a better  
general purpose way to test .txt files, I'm all ears).

Thx,

--b


More information about the IPython-user mailing list