Re: [Numpy-discussion] doctest improvements patch (and possible regressions)

2009-12-15 Thread Fernando Perez
On Sat, Dec 12, 2009 at 11:27 PM, Paul Ivanov  wrote:
> So far, no one has voiced objections, so should I go ahead and check
> this in?
>

+1 from me, at least.

I don't see how there could be a downside to fixing a ton of tests :)

Cheers,

f
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] doctest improvements patch (and possible regressions)

2009-12-12 Thread Paul Ivanov
So far, no one has voiced objections, so should I go ahead and check
this in?

btw, thanks Mike, what about this one:

>>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, '')).all()
... # XXX: is this a regression? this line now returns False -pi
... # np.char.lstrip(c,'') does not modify c at all.
True

best,
Paul Ivanov

Michael Droettboom, on 2009-12-09 06:04, wrote:
> Paul Ivanov wrote:
>> I marked up suspicious differences with XXX, since I don't know if
>> they're significant. In particular:
>>  - shortening a defchararray by strip does not change it's dtype to a
>> shorter one (apparently it used to?)
> Yes.  The new behavior is to return a string array with the same 
> itemsize as the input array.  That's primarily just the result of the 
> new implementation rather than a thought out change, though.
> 
> Sorry, just commenting on the parts I feel competent in :)  But I think 
> this is a great improvement.  It would be nice to start doing doctests 
> as a matter of course to keep the docs accurate.
> 
> Mike
> 

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] doctest improvements patch (and possible regressions)

2009-12-10 Thread Fernando Perez
On Wed, Dec 9, 2009 at 6:04 AM, Michael Droettboom  wrote:
> Sorry, just commenting on the parts I feel competent in :)  But I think
> this is a great improvement.  It would be nice to start doing doctests
> as a matter of course to keep the docs accurate.
>

Indeed.  From the sidelines, thanks a lot to Paul for this work!

Speaking of testing, here's a bit of code that I've had for a while
pending for ipython, but which I think could be very useful for numpy
too.  Feel free to rip only the parts you need...

The point of this code is to get a few nose-style features that
produce normal unittests.  In particular, it introduces support for
single functions to be tests (something nose does but unittest
doesn't), and most importantly, parametric tests that can be debugged
meaningfully.  A simple example:

def is_smaller(i,j):
assert i

lightunit.tgz
Description: GNU Zip compressed data
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] doctest improvements patch (and possible regressions)

2009-12-09 Thread Michael Droettboom
Paul Ivanov wrote:
> I marked up suspicious differences with XXX, since I don't know if
> they're significant. In particular:
>  - shortening a defchararray by strip does not change it's dtype to a
> shorter one (apparently it used to?)
Yes.  The new behavior is to return a string array with the same 
itemsize as the input array.  That's primarily just the result of the 
new implementation rather than a thought out change, though.

Sorry, just commenting on the parts I feel competent in :)  But I think 
this is a great improvement.  It would be nice to start doing doctests 
as a matter of course to keep the docs accurate.

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] doctest improvements patch (and possible regressions)

2009-12-08 Thread Paul Ivanov
Hi Numpy-devs,

I'm a long time listener, first time caller. I grabbed 1.4.0rc1 and was
happy that all the tests passed. But then I tried:

   >>> import numpy as np
   >>> np.test(doctests=True)
   ...
   Ran 1696 tests in 22.027s

   FAILED (failures=113, errors=24)

I looked at some of the failures, and they looked like trivial typos. So
I said to myself: "Self, wouldn't it be cool if all the doctests worked?"

Well, I didn't quite get there spelunking and snorkeling in the source
code a few evenings during the past week, but I got close.  With the
attached patch (which patches the 1.4.0rc1 tarball), I now get:

   >>> import numpy as np
   >>> np.test(doctests=True)
   ...
   Ran 1696 tests in 20.937s

   FAILED (failures=33, errors=25)


I marked up suspicious differences with XXX, since I don't know if
they're significant. In particular:
 - shortening a defchararray by strip does not change it's dtype to a
shorter one (apparently it used to?)
 - the docstring for seterr says that np.seterr() should reset all
errors to defaults, but clearly doesn't do that
 - there's a regression in recfunctions which may be related to #1299
and may have been fixed
 - recfunctions.find_duplicates ignoremask flag has no effect.

There are a few other things, but they're minor (e.g. I added a note
about how missing values are filled with usemask=False in
recfunctions.merge_arrays).

I think the only code I added was to testing/noseclasses.py. There, if a
test fails, I give a few more chances to pass by normalizing the
endianness of both desired and actual output, as well as default int
size for 32 and 64 bit machines. This is done just using replace() on
the strings.

Everything else is docstring stuff, so I was hoping to sneak this into
1.4.0, since it would make it that much more polished.

Does that sound crazy?

best,
Paul Ivanov


better-doctests.patch.gz
Description: GNU Zip compressed data
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion