[IPython-user] [IPython-dev] Doctest fixes, testing release out

Jörgen Stenarson jorgen.stenarson@bostream...
Sat Sep 8 03:10:34 CDT 2007


Fernando Perez skrev:
> On 8/23/07, Jörgen Stenarson <jorgen.stenarson@bostream.nu> wrote:
> 
>>> No, it should just work.  I'm a bit swamped right now, but I'll look
>>> into it as soon as I can.  I want all doctest functionality to really
>>> 'just work', no fuss.
> 
> OK, I got this code in along with other things I had pending for
> 0.8.2.  Let me know what you see...
> 
> Cheers,
> 
> f
> 
Unfortunately I still see problems (rev 2741). There is no traceback and 
a doctest call seems to work but it does not report any errors.

/Jörgen

try_doctest.py:

import doctest

def a(x):
     """
     >>> a(10)
     11x
     >>> a(31)
     32
     """
     return x+1


def _test():
     doctest.testmod()

if __name__=="__main__":
     _test()


Running try_doctest.py as regular python script and from ipython:



C:\python\ipython>python try_doctest.py
**********************************************************************
File "try_doctest.py", line 5, in __main__.a
Failed example:
     a(10)
Expected:
     11x
Got:
     11
**********************************************************************
1 items had failures:
    1 of   2 in __main__.a
***Test Failed*** 1 failures.

C:\python\ipython>ipython
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2.svn.r2710 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: %run try_doctest.py

In [2]: %doctest_mode
*** Pasting of code with ">>>" or "..." has been enabled.
Exception reporting mode: Plain
Doctest mode is: ON

 >>> %run try_doctest.py
*** DocTestRunner.merge: '__main__' in both testers; summing outcomes.

 >>>
Do you really want to exit ([y]/n)?

C:\python\ipython>



More information about the IPython-user mailing list