-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add polynomial s shape impact function #878
Conversation
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.
Thanks for the addition! I think the function will be very useful.
Please improve the documentation and the tests. One linter issue can also easily be fixed.
np.testing.assert_array_almost_equal(impf.mdd, np.zeros(5)) | ||
test_aux_vars(impf) | ||
|
||
with self.assertRaises(ValueError): |
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.
Check actual error
with self.assertRaises(ValueError): | |
with self.assertRaisesRegex(ValueError, "Exponent value"): |
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.
Thanks for the correction! Why should we priorize using assertRaisesRegex
?
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.
Because it tests the actual error message. assertRaises
would succeed with any ValueError
thrown, but you want to test for a specific one here.
Note that this is basically a shortcut for the idiom we were using so far:
with self.assertRaises(Exception) as cm:
do_stuff()
self.assertIn("Text", str(cm.exception))
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.
Makes total sense, thanks!
Co-authored-by: Lukas Riedel <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
Ok, I fixed all that you proposed, thanks! I also fixed one test and made sure that for |
Great work! Will merge. |
--------- Co-authored-by: Chahan Kropf <[email protected]> Co-authored-by: emanuel-schmid <[email protected]> Co-authored-by: Lukas Riedel <[email protected]>
Changes proposed in this PR:
This PR fixes #
PR Author Checklist
develop
)PR Reviewer Checklist