-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
unittest.mock.call can't represent calls to a method called 'parent' #79538
Comments
While working on https://bugs.python.org/issue35226, I stumbled upon this: >>> from unittest.mock import call
>>> call.parent()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable Guess we need to make .parent and friends more uniquely named ;-) |
I've just stumbled upon this issue while looking for a good first issue to contribute on. If the community agrees this is something that needs to be done, I'll gladly work on this. |
Go for it! :-) |
I see 2 most applicable ways to do it:
As long as those are accessed only from within the mock class, I think second method would be better as it would completely remove them from mock's attributes. |
Not sure I follow the second option, I was thinking of just _mock_parent and _mock_name when I logged this. Happy to see a PR for either though! |
I was considering wrapping a |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: