Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-130425: Add "Did you mean [...]" suggestions fordel obj.attr#130799

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Pranjal095 wants to merge9 commits intopython:main
base:main
Choose a base branch
Loading
fromPranjal095:delattr-suggestions-combined

Conversation

Pranjal095
Copy link

@Pranjal095Pranjal095 commentedMar 3, 2025
edited by picnixz
Loading

Merges PR#130427 implementing delattr suggestions by@sobolevn and PR#130455 adding tests for the feature by@Pranjal095

Note: This PR's sole purpose is to combine the feature implementation from PR#130427 with the test cases from PR#130455. All original commits have been preserved to retain proper authorship.

sobolevnand others added8 commitsFebruary 22, 2025 01:23
@picnixzpicnixz changed the titleMerge PR #130427 and PR #130455 implementing delattr suggestionsgh-130425: Add "Did you mean [...]" suggestions fordel obj.attrMar 3, 2025
Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I also don't think that merging a fix with tests into one PR is a good idea. When we have a fix and new tests - we usually merge them as different PRs, that's the first time I see that we combine PRs :)

self.assertIn("'bluch'", self.get_suggestion(A(), '_luch'))
self.assertIn("'bluch'", self.get_suggestion(A(), '_bluch'))
obj = A()
if operation == "getattr":
Copy link
Member

Choose a reason for 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 addsetattr 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:

classGetattrSuggestionsTests(BaseSuggestionsTests,unittest.TestCase):defget_suggestion(self,obj,name):# get suggestions using `getattr`classSetattrSuggestionsTests(BaseSuggestionsTests,unittest.TestCase):defget_suggestion(self,obj,name):# get suggestions using `setattr`# the same for `delattr`

Copy link
Author

@Pranjal095Pranjal095Mar 4, 2025
edited
Loading

Choose a reason for 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:

  1. The concerning issue was raised for adding delattr suggestions alone.
  2. There are multiple ways to simulate an AttributeError for setattr (custom__slots__,@property etc.), and I felt it would be better to discuss the appropriate testing mechanism in a separate PR.

Copy link
Author

Choose a reason for 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hello, just a gentle reminder to review the PR changes whenever convenient:)@sobolevn@picnixz

@bedevere-app
Copy link

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 phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@picnixz
Copy link
Member

picnixz commentedMar 4, 2025
edited
Loading

I also don't think that merging a fix with tests into one PR is a good idea

I would have actually expected that to be a feature and not a fix actually!

When we have a fix and new tests - we usually merge them as different PRs, that's the first time I see that we combine PRs

I actually always combined my fixes with my tests to check indeed that my fix is correct. Same for features.

encukou reacted with thumbs up emoji

@python-cla-bot
Copy link

python-cla-botbot commentedApr 18, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@sobolevnsobolevnAwaiting requested review from sobolevn

@methanemethaneAwaiting requested review from methanemethane is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Pranjal095@picnixz@methane@sobolevn

[8]ページ先頭

©2009-2025 Movatter.jp