• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hgrecco / pint / 782
92%
master: 91%

Build:
Build:
LAST BUILD BRANCH: fix-nonmult-doc
DEFAULT BRANCH: master
Ran 13 Apr 2018 11:02PM UTC
Jobs 12
Files 16
Run time 9min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
782

push

travis-ci

bors[bot]
Merge #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 <cpascual@cells.es>

2834 of 3202 relevant lines covered (88.51%)

10.22 hits per line

Jobs
ID Job ID Ran Files Coverage
1 782.1 (UNCERTAINTIES="N" PYTHON="3.3" NUMPY_VERSION=1.9.2) 13 Apr 2018 11:02PM UTC 0
86.23
Travis Job 782.1
2 782.2 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:06PM UTC 0
86.29
Travis Job 782.2
3 782.3 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:06PM UTC 0
86.29
Travis Job 782.3
4 782.4 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:06PM UTC 0
88.23
Travis Job 782.4
5 782.5 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:06PM UTC 0
86.29
Travis Job 782.5
6 782.6 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=0) 13 Apr 2018 11:05PM UTC 0
77.73
Travis Job 782.6
7 782.7 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=0) 13 Apr 2018 11:07PM UTC 0
77.73
Travis Job 782.7
8 782.8 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=1.14) 13 Apr 2018 11:09PM UTC 0
86.29
Travis Job 782.8
9 782.9 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.14) 13 Apr 2018 11:10PM UTC 0
86.23
Travis Job 782.9
10 782.10 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.14) 13 Apr 2018 11:10PM UTC 0
86.23
Travis Job 782.10
11 782.11 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.14) 13 Apr 2018 11:10PM UTC 0
88.16
Travis Job 782.11
12 782.12 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.14) 13 Apr 2018 11:11PM UTC 0
86.13
Travis Job 782.12
Source Files on build 782
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #782
  • fc2c503b on github
  • Prev Build on staging (#774)
  • Next Build on staging (#786)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc