Repository navigation
Convert typing tests from reveal_type+comments to assert_type - #1063
Merged
Merged
Conversation
Member
|
I am reviewing this manually now, I've found several problems. This is the first step to change the typing tests for better :) |
sobolevn
marked this pull request as ready for review
June 13, 2026 11:36
sobolevn
approved these changes
Jun 13, 2026
Member
|
Sorry for using AI-slop, but I did not want to manually convert all this copy-paste code :( |
Contributor
|
Thanks @sobolevn! Reviewed and verified the key parts:
One non-blocking nit: |
sobolevn
enabled auto-merge
June 14, 2026 16:58
sobolevn
added this pull request to the merge queue
Jun 14, 2026
pull Bot
pushed a commit
to Mu-L/msgspec
that referenced
this pull request
Sep 24, 2026
The changelog has not been updated since the `## Version 0.22.0` section was written, and that release was never published: PyPI still serves 0.21.1, and the tag and GitHub release were removed after the failed run. Adds ten entries under `## Unreleased`, covering twelve pull requests merged after 2026-08-11. That is where they belong while the release date is unknown. The entry for msgspec#1165 moves there from the 0.22.0 section for the same reason, since its fix was merged on 2026-09-05. msgspec#1063 and msgspec#1064 are added to the aggregated type stub line in the 0.22.0 section: two June pull requests that edit shipped `.pyi` files and were missing entirely. A second commit extends `scripts/release_github.py` to substitute `{issue}` references as well as `{pr}` ones, so they stop reaching the release body as literal markup. --------- Co-authored-by: Tseluiko Aleksandr <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the custom
reveal_type+exec'd comment assertion approach withtyping_extensions.assert_type, making type assertions first-class errors caught directly by the type checker.Before:
After:
Changes
basic_typing_examples.py: Replaced all 162reveal_type()+comment assertions withassert_type(x, T). Addedassert_typeandBuffertotyping_extensionsimports. Two spots where mypy and pyright genuinely disagree on the inferred type use variable assignments instead:__match_args__iteration: pyright narrows toLiteral['x', 'y'], mypy givesstr→_field_str: str = fieldis_struct_typeelse-branch ontype[Any]: pyright givesAny | type[Any], mypy givestype[Any]→_other_type: type[Any] = othertest_mypy.py/test_pyright.py: Replaced the custom output-parsing harness with a simple "run type checker, assert exit code 0" check.assert_typemismatches now surface directly as type checker errors.Refs #1042