GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — gh-130425: Add "Did you mean [...]" suggestions for `del obj.attr` by Pranjal095 · Pull Request #130799 · python/cpython Conversation
|
| self.assertIn("'bluch'", self.get_suggestion(A(), '_luch')) | ||
| self.assertIn("'bluch'", self.get_suggestion(A(), '_bluch')) | ||
| obj = A() | ||
| if operation == "getattr": |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't quite like the current design :(
It would be even more complex, when we add setattr tests (btw, I think that they should also be added in this PR).
Can we instead create a base class out of existing testcase? And then create three subclasses which would look like so:
class GetattrSuggestionsTests(BaseSuggestionsTests, unittest.TestCase): def get_suggestion(self, obj, name): # get suggestions using `getattr` class SetattrSuggestionsTests(BaseSuggestionsTests, unittest.TestCase): def get_suggestion(self, obj, name): # get suggestions using `setattr` # the same for `delattr`
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'll first refactor the tests as per your suggestion, and keep that as a separate commit.
I was unsure of adding setattr suggestion tests to this PR because:
__slots__, @property etc.), and I felt it would be better to discuss the appropriate testing mechanism in a separate PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I have made the requested changes as per the refactor request. Kindly review the PR again.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I would have actually expected that to be a feature and not a fix actually!
I actually always combined my fixes with my tests to check indeed that my fix is correct. Same for features. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @sobolevn @picnixz, it has been a while since I addressed the feedback on this PR and noticed this is still open. Would you mind taking another look when you have a moment? Let me know if there's anything further I can do. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The interface is now a bit too nested. We have many nested classes and this is not the best I think. I suggest the following:
class AttributeSuggestions: def get_suggestion(...): ... class GetattrSuggestions(AttributeSuggestions): ... class DelattrSuggestions(AttributeSuggestions): ... class SetattrSuggestions(AttributeSuggestions): ...
And then create the additional classes as you did that inherit from different mixins. But we don't need to touch SuggestionFormattingTestBase for delattr/getattr/hasattr etc. We can just make a separate class. If there is a common interface between SuggestionFormattingTestBase and those classes, make an even top class, say SuggestionFormattingTestBaseParent and SuggestionFormattingTestBase would inherit from it. That way you can share a common interface (I don't know if I'm clear enough).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0b58966 to
0ecb6d8
Compare
|
Please avoid force-pushing. I'm going to close this one as many people were notified and suggeset you to create a fresh PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.