-
Notifications
You must be signed in to change notification settings - Fork 370
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
Further improvement of parameter operator test implementation #2631
Further improvement of parameter operator test implementation #2631
Conversation
I dug deeper into the xfail documentation and found that one can mark individual cases explicitly as xfail, while cases that should pass can be provided as usual. I hope you like the new implementation. |
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 looks very nice! I'm guessing the newly added .bak
file is unintentional and should therefore be removed before merge.
Thanks for noticing, I have removed the file again. |
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.
Just a small typo. Otherwise nice work!
Co-authored-by: Jochen Martin Eppler <[email protected]>
This PR makes the parameter operator tests even more readable and efficient. It is a follow-up to #2628.
Concerning efficiency, tests using Py 3.11 indicate that using
hasattr()
instead oftry-except
improves performance by almost half.One could argue that the test code here would become even simpler of the nest Parameter objects supported direct casting to
int
orfloat
. But these parameters are only to be evaluated inside the C++ kernel, so adding__int__()
or__float()__
methods at the Python level would only simplify test-writing, with no bearing on actual use. But writing code for the sake of testing only seems not sensible.