fix:get_params returns copy preventing state mutation along with adding tests#497
Open
amanpandey2587 wants to merge 1 commit intodswah:mainfrom
Open
fix:get_params returns copy preventing state mutation along with adding tests#497amanpandey2587 wants to merge 1 commit intodswah:mainfrom
amanpandey2587 wants to merge 1 commit intodswah:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @cbrummitt @fkiraly @dswah , I have made the following changes in the codebase which Closes #496
I have changed core.py file
attrs = self.__dict__toattrs = dict(self.__dict__), this preventsget_paramsfrom mutating object state during read and preventsdeep=Trueto return a live internal dict that external callers can mutate.I have also added core-level regression tests in the pygam/tests/test_core.py and model-level regression test in pygam/tests/test_GAM_methods.py file in order to check the approach.
For Validation I ran

python -m pytest pygam/tests/test_core.py pygam/tests/test_GAM_methods.py -k get_params -p no:cacheproviderto specially run the tests and I am attaching the screenshot of successfully passing them as well .Please guide me for any further changes. I would be happy to do them.
Thanks