Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_compact handles prefixed units incorrectly. #960

Closed
hgrecco opened this issue Dec 28, 2019 · 0 comments · Fixed by #996
Closed

to_compact handles prefixed units incorrectly. #960

hgrecco opened this issue Dec 28, 2019 · 0 comments · Fixed by #996
Labels

Comments

@hgrecco
Copy link
Owner

hgrecco commented Dec 28, 2019

There is a bug in to_compact handling the unit argument

>>> (1 * ureg.nanometer).to_compact(ureg.micrometer)
<Quantity(1.0000000000000002, 'millimicrometer')>

when the unit is prefixed

@hgrecco hgrecco added the bug label Dec 28, 2019
bors bot added a commit that referenced this issue Jan 22, 2020
996: Fix Bug Quantity to_compact r=hgrecco a=jules-ch

- Handles unit in to_compact function.
- Use same function infer_base_unit on Quantity based on input unit.
- Add unit test in test_issues.py

- [x] Closes #960
- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [x] The change is fully covered by automated unit tests
- [x] Added an entry to the CHANGES file


Co-authored-by: Jules Chéron <[email protected]>
@bors bors bot closed this as completed in 90bad48 Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant