updated physics/archimedes_principle.py#10479
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
… allowed zero gravity
| if volume < 0: | ||
| if volume <= 0: | ||
| raise ValueError("Impossible Object volume") | ||
| if gravity <= 0: | ||
| if gravity < 0: |
There was a problem hiding this comment.
Please revert these changes. It is useful to be able to make theoretical calculations even if we are unable to reproduce those conditions.
There was a problem hiding this comment.
should I remove the tests as well or just make the signs as they were before?
There was a problem hiding this comment.
The tests need to follow the code. It is OK to have the tests but their output must pass.
There was a problem hiding this comment.
The numerical tests are passing. Just added some more tests to see for when the inputs are invalid physically as in negative gravity, non positive volume and non positive density as they were already in the original code by the author.
These are also passing the tests.
There was a problem hiding this comment.
Dude! There are 215 pull requests open. Perhaps we will get to review this one.
|
Great! Looks better now! |
Describe your change:
modified physics/archimedes_principle.py
added some doctests for exception handling, imported g from scipy rather than hard coding and allowed zero gravity to be valid giving value 0 in that case
fixes issue #9943
Checklist: