[Numpy-discussion] doctests failing in ipython

Robert Kern robert.kern@gmail....
Fri Jul 11 02:50:16 CDT 2008


On Fri, Jul 11, 2008 at 02:40, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
>
> On Fri, Jul 11, 2008 at 1:29 AM, Robert Kern <robert.kern@gmail.com> wrote:
>>
>> On Fri, Jul 11, 2008 at 02:11, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>> > The problem is the Out[#] appended to the output.
>> >
>> > ................................................Out[4]: poly1d([ 1.,
>> >  2.,
>> > 3.])
>> > **********************************************************************
>> > File
>> > "/usr/lib/python2.5/site-packages/numpy/lib/tests/test_polynomial.py",
>> > line 6, in test_polynomial
>> > Failed example:
>> >     p
>> > Expected:
>> >     poly1d([ 1.,  2.,  3.])
>> > Got nothing
>> >
>> > Tons of these.
>>
>> Yes. This is well-known. IPython cannot run doctests in general
>> without modification. This is not a bug in numpy's tests; just an
>> incompatibility between IPython and doctest.
>
> I don't think any of the unit tests should be doctests. They look ugly and
> are hard to read.

<shrug> Sometimes, they're the most convenient way to express a bunch
of tests, in my opinion. You're welcome to have a differing opinion,
but you haven't convinced me to reconsider mine.

> Second, I didn't used to see the problem.

When? Exactly what did you run? I don't see this problem with the
trunk of numpy (and IPython, incidentally):

In [1]: import numpy

In [2]: numpy.test()
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 1744 tests in 8.595s

OK
Out[2]: <nose.result.TextTestResult run=1744 errors=0 failures=0>


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list