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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rohanwinsor
Copy link

@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
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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants