Skip to content
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

gh-83403: Test parent param in Mock.__init__ #103630

Merged
merged 4 commits into from
May 30, 2023
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Apr 19, 2023

I was not able to find any explict tests for parent init parameter, so I've added one.
If you think that simple doc that I've added is too short (which I believe is good enough already), I can add more details to it.

Skipping news, because there are no user-facing change.

Lib/unittest/mock.py Outdated Show resolved Hide resolved
@cjw296
Copy link
Contributor

cjw296 commented Apr 23, 2023

I'm not sure it's intended for parent to be part of the public API. @tirkarthi / @mariocj89 / @voidspace - thoughts?

@voidspace
Copy link
Contributor

I'm not sure it's intended for parent to be part of the public API. @tirkarthi / @mariocj89 / @voidspace - thoughts?

parent is definitely not part of the public API.

@sobolevn
Copy link
Member Author

sobolevn commented Apr 23, 2023

I'm a bit confused. Aren't non-public members of Mock API hidden with _ like _spec_state, _new_name, _new_parent, _spec_as_instance, _eat_self?

@voidspace
Copy link
Contributor

I'm a bit confused. Aren't non-public members of Mock API hidden with _ like _spec_state, _new_name, _new_parent, _spec_as_instance, _eat_self?

In general, yes. parent was an oversight - taking the "private by undocumented approach", but intended to be private. My apologies.

@sobolevn
Copy link
Member Author

So, should I remove the docs part? The test looks useful in any case.

@voidspace
Copy link
Contributor

Yes, the test looks useful but remove the docs.

@sobolevn
Copy link
Member Author

Done, thanks a lot for the review! 👍

@sobolevn sobolevn changed the title gh-83403: Document and test parent param in Mock.__init__ gh-83403: Test parent param in Mock.__init__ Apr 24, 2023
@sobolevn
Copy link
Member Author

@voidspace @cjw296 @hugovk friendly ping :)

@cjw296 cjw296 merged commit 219f01b into python:main May 30, 2023
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.

5 participants