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

hgrecco / pint / 1412
92%
master: 91%

Build:
Build:
LAST BUILD BRANCH: fix-nonmult-doc
DEFAULT BRANCH: master
Ran 20 Dec 2019 01:14AM UTC
Jobs 13
Files 170
Run time 4min
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
1412

push

travis-ci

web-flow
Merge #938

938: Use contexts to redefine units r=hgrecco a=crusaderky

- [x] Closes #853 - Context.define for currency conversions
- [x] Closes #932 - Disable all throwaway contexts
- [x] Contexts that only implement transforms between dimensionalities (that is, all contexts until now) no longer require their own cache and therefore are enabled in microseconds even on the first time; contexts that implement redefinitions require a *much* smaller cache than before which is very quickly built on demand.
- [x] NaN is now parsed as a float

- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [x] The change is fully covered by automated unit tests
- [x] Documented in docs/ as appropriate
- [x] Added an entry to the CHANGES file


# Demo
```python
import pint

ureg = pint.UnitRegistry()
ureg.load_definitions("""
USD = [currency]
EUR = NaN USD
GBP = NaN USD

@context currencies_20191218
    EUR = 1.11 USD
    GBP = 1.18 EUR
@end

@context dungeons_and_dragons = dnd
    # Simplified conversion rates for the
    # non-English versions of the D&D manuals
    pound = 0.5 kg
    gallon = 4 l
    foot = 1.5/5 m
@end
""".splitlines())

>>> ureg.GBP.dimensionality
<UnitsContainer({'[currency]': 1.0})>
>>> ureg.Quantity("10 GBP")
10 GBP
>>> ureg.Quantity("10 GBP").to("USD")
nan USD
>>> ureg.Quantity("10 GBP").to("USD", "currencies_20191218")
13.098 USD
>>> ureg.Quantity("10 ft").to("m")
3.0479999999999996 meter
>>> ureg.Quantity("10 ft").to("m", "dnd")
3.0 meter
```


Co-authored-by: Guido Imperiale <crusaderky@gmail.com>

31015 of 36392 relevant lines covered (85.22%)

10.19 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1412.1 (PKGS="python=3.7 flake8 black isort") 20 Dec 2019 01:14AM UTC 0
Travis Job 1412.1
2 1412.2 (PKGS="python=3.6") 20 Dec 2019 01:14AM UTC 0
76.48
Travis Job 1412.2
3 1412.3 (PKGS="python=3.7") 20 Dec 2019 01:14AM UTC 0
76.48
Travis Job 1412.3
4 1412.4 (PKGS="python=3.8") 20 Dec 2019 01:14AM UTC 0
76.85
Travis Job 1412.4
6 1412.6 (PKGS="python=3.7 uncertainties=3.0") 20 Dec 2019 01:16AM UTC 0
89.29
Travis Job 1412.6
7 1412.7 (PKGS="python=3.6 numpy=1.14") 20 Dec 2019 01:16AM UTC 0
85.38
Travis Job 1412.7
8 1412.8 (PKGS="python=3.7 numpy=1.14") 20 Dec 2019 01:16AM UTC 0
85.38
Travis Job 1412.8
9 1412.9 (PKGS="python=3.8 numpy=1.17") 20 Dec 2019 01:16AM UTC 0
87.66
Travis Job 1412.9
10 1412.10 (PKGS="python=3.6 numpy=1.14 uncertainties=3.0") 20 Dec 2019 01:17AM UTC 0
87.23
Travis Job 1412.10
11 1412.11 (PKGS="python=3.7 numpy=1.14 uncertainties=3.0") 20 Dec 2019 01:18AM UTC 0
87.31
Travis Job 1412.11
12 1412.12 (PKGS="python=3.6 numpy uncertainties") 20 Dec 2019 01:18AM UTC 0
89.37
Travis Job 1412.12
13 1412.13 (PKGS="python=3.7 numpy uncertainties") 20 Dec 2019 01:18AM UTC 0
89.37
Travis Job 1412.13
14 1412.14 (PKGS="python=3.8 numpy uncertainties") 20 Dec 2019 01:18AM UTC 0
89.46
Travis Job 1412.14
Source Files on build 1412
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1412
  • 25dfa428 on github
  • Prev Build on staging (#1405)
  • Next Build on staging (#1414)
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