Add polynomial s shape impact function#878
Conversation
peanutfun
left a comment
There was a problem hiding this comment.
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.
Check actual error
| with self.assertRaises(ValueError): | |
| with self.assertRaisesRegex(ValueError, "Exponent value"): |
There was a problem hiding this comment.
Thanks for the correction! Why should we priorize using assertRaisesRegex ?
There was a problem hiding this comment.
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.
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