Remove mypy error codes from the test_cases
directory
#8083
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes mypy error codes from the
test_cases
directory, and altersmypy_test
so that it no longer enforces thattype: ignore
s in thetest_cases
directory have mypy error codes.When I created the first test cases, it seemed like a good idea to enforce mypy error codes, as we use mypy error codes in most of the rest of typeshed. But
type: ignore
s in thetest_cases
directory serve a different purpose to those in the rest of typeshed -- whereas in the rest of typeshed we use them to stop a type checker complaining where we're doing something it doesn't quite understand, in thetest_cases
directory we use them to signify "this code is meant to fail a type checker". As a result, whereas the error codes in the rest of typeshed help make the stubs more self-documenting, it feels like the error codes in thetest_cases
directory just end up adding noise. They're also mypy-specific, and, in general, we should probably aim to have as little stuff in typeshed as possible that's specific to one type checker.More discussion here: #8066 (comment)