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

hgrecco / pint / 783
91%

Build:
DEFAULT BRANCH: master
Ran 13 Apr 2018 11:15PM UTC
Jobs 12
Files 16
Run time 6min
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
783

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>

14 of 14 new or added lines in 1 file covered. (100.0%)

2834 of 3202 relevant lines covered (88.51%)

10.22 hits per line

Jobs
ID Job ID Ran Files Coverage
1 783.1 (UNCERTAINTIES="N" PYTHON="3.3" NUMPY_VERSION=1.9.2) 13 Apr 2018 11:15PM UTC 0
86.23
Travis Job 783.1
2 783.2 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:15PM UTC 0
86.2
Travis Job 783.2
3 783.3 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:15PM UTC 0
86.29
Travis Job 783.3
4 783.4 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:15PM UTC 0
88.23
Travis Job 783.4
5 783.5 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.11.2) 13 Apr 2018 11:15PM UTC 0
86.2
Travis Job 783.5
6 783.6 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=0) 13 Apr 2018 11:17PM UTC 0
77.73
Travis Job 783.6
7 783.7 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=0) 13 Apr 2018 11:17PM UTC 0
77.73
Travis Job 783.7
8 783.8 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=1.14) 13 Apr 2018 11:18PM UTC 0
86.29
Travis Job 783.8
9 783.9 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.14) 13 Apr 2018 11:19PM UTC 0
86.23
Travis Job 783.9
10 783.10 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.14) 13 Apr 2018 11:20PM UTC 0
86.23
Travis Job 783.10
11 783.11 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.14) 13 Apr 2018 11:21PM UTC 0
88.16
Travis Job 783.11
12 783.12 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.14) 13 Apr 2018 11:21PM UTC 0
86.23
Travis Job 783.12
Source Files on build 783
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #783
  • fc2c503b on github
  • Prev Build on master (#775)
  • Next Build on master (#787)
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