Fix BaseMetaObject.set_params to correctly call reset method#413
Fix BaseMetaObject.set_params to correctly call reset method#413Ankush1oo8 wants to merge 6 commits intosktime:mainfrom
Conversation
There was a problem hiding this comment.
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.
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