-
Notifications
You must be signed in to change notification settings - Fork 28
Fix BaseMetaObject.set_params to correctly call reset method #413
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
base: main
Are you sure you want to change the base?
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 contribution, good start!
I think this does not address the issue though - reset needs to be called after the parameters have been set.
Plus, _set_params calls super().set_params which has a reset. Why does this not have the intended effect?
Plus, some of the matching logic in BaseObject is missing. I would recommend to do a refactor where
The test is not appropriate though, since it overwrites reset.
Instead, I would write a parameter to obj and check whether it gets removed.
|
Thanks for working on this @Ankush1oo8. In addition to comments by @fkiraly, I would like the test to set another variable in
|
|
Thanks @Ankush1oo8. Does the test still pass if you remove the hardcoded definition for The expectation is that the definition of |
| class ResetCheckMetaObject(BaseMetaObject): | ||
| def __init__(self, a=1, steps=None): | ||
| self.a = a | ||
| self.steps = steps if steps is not None else [] |
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 is not compliant with the API - self params should never be changed.
There should also be steps_ etc, and we should also do get_params in the test.
Perfect! Here’s how you can fill out the PR using their template, keeping it clean, detailed, and aligned with the contribution guidelines:
Reference Issues/PRs
Issue #412
What does this implement/fix? Explain your changes.
This PR adds a unit test to verify that
BaseMetaObject.set_paramscorrectly calls thereset()method when parameters are updated.Previously, the test failed due to a missing
stepsattribute, which is required byBaseMetaObjectduring parameter handling. This issue is resolved by explicitly definingsteps=[]in the test subclass used for validation.Does your contribution introduce a new dependency? If yes, which one?
No
What should a reviewer concentrate their feedback on?
reset()method callBaseMetaObjectin the testAny other comments?
All tests pass locally (
1572 passed, 1 warning). This test improves coverage and ensures robustness of metaobject behavior during param updates.PR checklist
For all contributions
For code contributions