Skip to content

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

Merged
cjw296 merged 4 commits into
python:mainfrom
sobolevn:issue-83403
May 30, 2023
Merged

gh-83403: Test parent param in Mock.__init__#103630
cjw296 merged 4 commits into
python:mainfrom
sobolevn:issue-83403

Conversation

@sobolevn

@sobolevn sobolevn commented Apr 19, 2023

Copy link
Copy Markdown
Member

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.

Comment thread Lib/unittest/mock.py Outdated
@cjw296

cjw296 commented Apr 23, 2023

Copy link
Copy Markdown
Contributor

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

@voidspace

Copy link
Copy Markdown
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

sobolevn commented Apr 23, 2023

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
Member Author

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

@voidspace

Copy link
Copy Markdown
Contributor

Yes, the test looks useful but remove the docs.

@sobolevn

Copy link
Copy Markdown
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
Copy Markdown
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