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

hgrecco / pint / 1114
91%

Build:
DEFAULT BRANCH: master
Ran 16 May 2019 01:25PM UTC
Jobs 12
Files 16
Run time 7min
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
1114

push

travis-ci

bors[bot]
Merge #805

805: Fix definition of dimensionless units r=hgrecco a=Jellby

There is something strange going on with dimensionless units/numbers:

```
>>> ureg.get_base_units('pi')
(3.141592653589793, <Unit('dimensionless')>)
>>> ureg.get_base_units('fine_structure_constant')
(1.0, <Unit('fine_structure_constant')>)
```

It seems dimensionless units defined in a file are interpreted as base units, while `pi` is hard-coded and interpreted correctly as a number. I think this is because for an empty list both `all()` and `not any()` are true. The fix is just changing the order of the tests, such that when a unit has no dimensions the `not any()` test passes first and the unit is marked as not-base. After the fix:

```
>>> ureg.get_base_units('pi')
(3.141592653589793, <Unit('dimensionless')>)
>>> ureg.get_base_units('fine_structure_constant')
(0.0072973525698, <Unit('dimensionless')>)
```

In addition, the hard-coded definition of `pi` is better done *before* loading the file definitions, I believe, so `pi` can be used in defining base units for `@system`, and also to allow redefining `pi` in a file, if desired. This also required removing the special treatment for `pi` in `_eval_token()`, which I don't think is need anyway.

Finally, I applied some corrections to the default definitions: Added `ln10` = ln(10), just to test the above fix with a number not subject to updates. Fixed the `deka-` prefix. Made the `acre_foot` consisent, I don't think it should use the survey foot for area times the international foot. Fixed the dry barrell, which I see everywhere defined as 7056 in^3, not 7065. Fixed spelling of "hundredweight" (if it was intentional, I still find it weird that the long and short ones are misspelled differently).

Co-authored-by: Jellby <jellby@yahoo.com>

2930 of 3312 relevant lines covered (88.47%)

10.13 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1114.1 (UNCERTAINTIES="N" PYTHON="3.3" NUMPY_VERSION=1.9.2 PANDAS=0) 16 May 2019 01:25PM UTC 0
85.66
Travis Job 1114.1
2 1114.2 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.11.2 PANDAS=0) 16 May 2019 01:26PM UTC 0
85.72
Travis Job 1114.2
3 1114.3 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.11.2 PANDAS=0) 16 May 2019 01:26PM UTC 0
85.72
Travis Job 1114.3
4 1114.4 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.11.2 PANDAS=0) 16 May 2019 01:27PM UTC 0
87.59
Travis Job 1114.4
5 1114.5 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.11.2 PANDAS=0) 16 May 2019 01:26PM UTC 0
85.63
Travis Job 1114.5
6 1114.6 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=0 PANDAS=0) 16 May 2019 01:28PM UTC 0
77.02
Travis Job 1114.6
7 1114.7 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=0 PANDAS=0) 16 May 2019 01:28PM UTC 0
76.84
Travis Job 1114.7
8 1114.8 (UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=1.14 PANDAS=0) 16 May 2019 01:31PM UTC 0
85.66
Travis Job 1114.8
9 1114.9 (UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.14 PANDAS=0) 16 May 2019 01:30PM UTC 0
85.39
Travis Job 1114.9
10 1114.10 (UNCERTAINTIES="N" PYTHON="3.5" NUMPY_VERSION=1.14 PANDAS=0) 16 May 2019 01:30PM UTC 0
85.39
Travis Job 1114.10
11 1114.11 (UNCERTAINTIES="Y" PYTHON="3.5" NUMPY_VERSION=1.14 PANDAS=0) 16 May 2019 01:33PM UTC 0
87.26
Travis Job 1114.11
12 1114.12 (UNCERTAINTIES="N" PYTHON="3.6" NUMPY_VERSION=1.14 PANDAS=0) 16 May 2019 01:32PM UTC 0
85.39
Travis Job 1114.12
Source Files on build 1114
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1114
  • fffc0710 on github
  • Prev Build on master (#1107)
  • Next Build on master (#1121)
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

© 2025 Coveralls, Inc