-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit tests fails with numpy 1.13.1 #577
Comments
Is anyone looking into this? |
Automated testing on Travis seems to be limited to numpy <= 1.11. So these failures are maybe not too surprising. Testing should be extended to include numpy 1.13.x and 1.14. Numpy 1.13 included improvements to help other projects with subclassing ndarray. Maybe the numpy support in pint can be improved now when using newer numpy versions. |
Hi @jetheurer , any progress? |
Hey @cpascual, I don't have anything yet, but I'll try to get something up by Saturday. Thanks for the 1st March info, that deadline is pretty close! |
Hi @jetheurer , do not worry: a debian dev told me that https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876921 does not mean that pint will be dropped from Ubuntu |
For reference: pint just dropped off Debian Buster (https://tracker.debian.org/pkg/python-pint) |
All packages depending on pint have been removed from Debian Buster/testing last week. A fix would be very welcome. |
I am going to give this a try myself. |
@cpascual, go for it. I dont have anything to show at the moment. |
Hi @jetheurer, @cpascual ,
|
@cmft That looks like a pretty quick fix. For some reason I thought the issue was more complicated than that - but maybe it wasn't too bad after all! |
@cpascual hi, were you planning to submit a patch for this? |
Hi @coreycb , yes, I am working on the patch. The problem is that I am not sure on how to approach it. For the moment I am focusing on the tests that give Error (the ones that test Quantity.ipow). I am also in touch with @cmft (we are co-workers) and we are trying to understand the ultimate cause of the failures with new numpy versions. |
update: I managed to fix the ipow errors and the test_isfinite fail. Now I am working on the test_isreal. Once I get it I'll make the PR |
Update: I finally created the PR. Anyone interested, please have a look at it in #630 |
630: Fix unit tests errors with numpy >=1.13 (Fix 577) r=cpascual a=cpascual This PR fixes the 4 test errors/failiures reported in #577 and adds new travis builds with numpy 1.14 3 of the 4 problems are relatively trivial to solve. The remaining one (`test_isreal`) is not so trivial because it involves allowing to compare a *non-dimensionless* quantity against zero. The reason is that `numpy.isreal(x)` essentially does `x.imag !=0` if the `imag` method is implemented in x... and since Quantity reimplements .imag to return units (see #171), the check always returns False if x is a non-dimensionless quantity. As mentioned, this can be solved by allowing comparisons against zero. Actually, this has already been requested in #194, but it was not implemented. In this PR, I implemented the comparison-to-zero feature and provide several new unit tests for it. AFAIK this implementation takes into account the concerns expressed by @hgrecco in #194. But if the feature is not wanted, we can just revert the last 3 commits of this PR and then `test_isreal` will left with an expected failure flag. The rules that I implemented for the comparison-with-zero are: ``` a) comparing against (non-quantity) zero is allowed for any quantity b) comparing against zero-magnitude quantities of incompatible dimensionality raises a Dimensionality error, except for the case of equality, for which it always returns False Notes: 1.- Numpy arrays of zeros are also supported and the comparison rules apply elementwise 2.- In the case of non-multiplicative units, the rules above apply after converting to base units if the autoconvert offset flag is set. Otherwise they raise an OffsetUnitCalculusError. ``` Fixes #577 Co-authored-by: Carlos Pascual <[email protected]>
Thanks for the fix! Could we have a new release with it, or should we rather cherry-pick it for the Debian package? |
There are still several things pending until 0.9 but I could release 0.8.2 if everyone agrees. |
That would be nice, and it would simplify packaging in debian... |
hi, fyi: I already uploaded cherry-picked version of this fix to Debian this morning. |
I have just updated CHANGES. Please notice that we will be releasing a 0.8.2 in which we have dropped support for Python 2.6, 3.0, 3.1 and 3.2 |
Refs: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876921
Thanks for fixing.
The text was updated successfully, but these errors were encountered: