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

hgrecco / pint / 377 / 31
91%
master: 91%

Build:
DEFAULT BRANCH: master
Ran 05 Feb 2015 10:23PM UTC
Files 7
Run time 1s
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

05 Feb 2015 10:07PM UTC coverage: 77.122% (-0.03%) from 77.149%
UNCERTAINTIES="N" NUMPY_VERSION=0

Pull #231

travis-ci

jpgrayson
Introduce 'u' to format only a Quantity's units

It is currently not possible to correctly format units (UnitsContainer
objects) using the '~' format spec.

    >>> format(q, '~')
    '17.0 km / s ** 2'
    >>> format(q.units, '~')
    'kilometer / second ** 2'

Notice how the units are different when formatted on their own.

In order for units to be properly formatted with '~', the UnitsRegistry
must be available so that the long names in the units container can be
mapped to their short, symbolic names. I.e. 'kilo' -> 'k' and 'meter' ->
'm'. A key problem is that UnitsContainer objects do not have access to
the UnitRegistry. When quantities are formatted, we cheat (a little) and
use the quantity's UnitRegistry (_REGISTRY) to perform the _get_symbol()
mapping in the case of '~'.

So we introduce 'u' as a formatting spec for Quantity that causes only
the unit, and not the magnitude, to be returned from format().

    >>> format(q, '~u')
    'km / s ** 2'
    >>> format(q, '~Pu')
    'km/s²'
Pull Request #231: Introduce 'u' to format only a Quantity's units

1554 of 2015 relevant lines covered (77.12%)

0.77 hits per line

Source Files on job 377.31 (UNCERTAINTIES="N" NUMPY_VERSION=0)
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 377
  • Travis Job 377.31
  • 8a0562dc on github
  • Prev Job for UNCERTAINTIES="N" NUMPY_VERSION=0 on master (#376.31)
  • Next Job for UNCERTAINTIES="N" NUMPY_VERSION=0 on master (#380.1)
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