Skip to content

Shortcut conversion factor#98

Merged
skeating merged 14 commits intodevelopfrom
shortcut_conversion_factor
Oct 22, 2019
Merged

Shortcut conversion factor#98
skeating merged 14 commits intodevelopfrom
shortcut_conversion_factor

Conversation

@skeating
Copy link
Copy Markdown
Contributor

@skeating skeating commented Oct 2, 2019

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 2, 2019

Codecov Report

Merging #98 into develop will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #98      +/-   ##
===========================================
+ Coverage    93.54%   93.61%   +0.06%     
===========================================
  Files            7        7              
  Lines          914      924      +10     
  Branches       198      200       +2     
===========================================
+ Hits           855      865      +10     
  Misses          34       34              
  Partials        25       25
Impacted Files Coverage Δ
cellmlmanip/units.py 95.87% <100%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5284857...371ed78. Read the comment docs.

Copy link
Copy Markdown
Contributor

@MauriceHendrix MauriceHendrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine in general, but it does have the danger of becoming a bit confusing.
I would say update the docstring to say that it requires a to_unit and either a to_unit, a quantity or an expression.

At the start of the method there are some useful asserts. It would be useful to assert that only 1 of from_unit, quantity, expression should be defined.
You could build a big if statement or do something like
assert [from_unit, quantity, expression].count(None) == 2

Also might it be worth in this case giving the parameters an explicit type (see for example add_equation), I think this would reduce potential for confusion.

Copy link
Copy Markdown
Contributor

@MauriceHendrix MauriceHendrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the consistency between the description and the assert (see comment above)

Comment thread cellmlmanip/units.py Outdated
Copy link
Copy Markdown
Contributor

@jonc125 jonc125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks fine but I spotted a couple of minor issues. Also the travis tests are failing; I think due to flake8 errors.

Comment thread tests/test_unit_conversion.py Outdated
Comment thread tests/test_unit_conversion.py Outdated
@skeating skeating requested a review from jonc125 October 15, 2019 14:42
Comment thread tests/test_unit_conversion.py Outdated
@skeating skeating requested a review from jonc125 October 15, 2019 15:10
@MichaelClerx
Copy link
Copy Markdown
Contributor

Hey @MauriceHendrix , do you approve of the changes?

@MauriceHendrix
Copy link
Copy Markdown
Contributor

Hey @MauriceHendrix , do you approve of the changes?

looks good to me. I'll need to update some code on my end but shouldn't be a big deal. Has it been marged into the master yet?

@skeating
Copy link
Copy Markdown
Contributor Author

@MauriceHendrix You need to confirm the changes/dismiss the review when you asked for changes before I can merge

@MauriceHendrix
Copy link
Copy Markdown
Contributor

@MauriceHendrix You need to confirm the changes/dismiss the review when you asked for changes before I can merge

Aah ok I didn't realise

@skeating skeating merged commit b32ec9e into develop Oct 22, 2019
@skeating skeating deleted the shortcut_conversion_factor branch October 22, 2019 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants