Skip to content

gh-137716: Fix double period in AttributeError message for invalid mock assertions #137717

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

Merged
merged 3 commits into from
Aug 14, 2025

Conversation

rohanwinsor
Copy link
Contributor

@rohanwinsor rohanwinsor commented Aug 13, 2025

@python-cla-bot
Copy link

python-cla-bot bot commented Aug 13, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Aug 13, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@StanFromIreland StanFromIreland changed the title gh- 137716: Fix double period in AttributeError message for invalid mock assertions gh-137716: Fix double period in AttributeError message for invalid mock assertions Aug 13, 2025
Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

I think this is the wrong place for this fix. This should be fixed in traceback IMO, it should not add another period if one exists.

@rohanwinsor
Copy link
Contributor Author

So here, we should check for self._str.rstrip().endsiwth(".") and add dot based on that.

But since dot is being added by default in the traceback, as well as all other attribute errors raised don't have dot in the end of them. Doesn't it make sense to remove it in mock ?

Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks!

I'm fine with this. We can pursue the traceback change independently, but most AttributeError do not end with a period

@hauntsaninja hauntsaninja enabled auto-merge (squash) August 14, 2025 21:20
@hauntsaninja hauntsaninja merged commit 8665769 into python:main Aug 14, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants