Skip to content

Add comment explaining NonCallableMock's Any subclassing #9496

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

Closed
wants to merge 2 commits into from

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 11, 2023

Brought back and reworded a 5yo comment explaining why NonCallableMock is subclassed with Any.

Feel free to wordsmith.

Ref: #9491

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

cwltool (https://github.com/common-workflow-language/cwltool)
- tests/test_cuda.py:3: note: ... from here:

@srittau
Copy link
Collaborator

srittau commented Jan 11, 2023

The problem here are not so much the false positives, but that mocks are explicitly designed to stand in for other types, something that can't be expressed with our static type system.

@AlexWaygood
Copy link
Member

I'd also rather avoid introducing unused type: ignores -- I'd rather introduce type: ignores for the false-positives all together as part of #9491.

@Avasam
Copy link
Collaborator Author

Avasam commented Jan 11, 2023

Closing in favor of #9491

@Avasam Avasam closed this Jan 11, 2023
@Avasam Avasam deleted the mock-subclassing-any branch February 29, 2024 00:44
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