-
Notifications
You must be signed in to change notification settings - Fork 2
Added desired units and tests #188
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #188 +/- ##
========================================
Coverage 81.15% 81.16%
========================================
Files 52 52
Lines 4267 4279 +12
Branches 740 742 +2
========================================
+ Hits 3463 3473 +10
- Misses 624 625 +1
- Partials 180 181 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not contain a valid label. Please add one of the following labels: ['[scope] bug', '[scope] enhancement', '[scope] documentation', '[scope] significant', '[scope] maintenance']
| try: | ||
| self._convert_unit(self._desired_unit) | ||
| except Exception as e: | ||
| raise UnitError(f'Failed to convert unit from {temporary_parameter.unit} to {self._desired_unit}: {e}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we completely bail out on bad unit conversion? Maybe return the original value with the original unit and warn users of the failure of the unit conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good question. I tend to think yes, since something must have gone wrong if the user expects a unit that is incompatible with the calculated unit.
Added desired units for the dependent parameter constructors, and a method to change it later:
set_desired_unit