[ty] Initial test suite for PEP-728 TypedDict features#23832
Merged
AlexWaygood merged 6 commits intomainfrom Mar 12, 2026
Merged
[ty] Initial test suite for PEP-728 TypedDict features#23832AlexWaygood merged 6 commits intomainfrom
TypedDict features#23832AlexWaygood merged 6 commits intomainfrom
Conversation
Replace the TODO comment about closed TypedDict narrowing with actual test cases that assert current behavior and mark expected improvements with TODO comments. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Update all PEP 728 (`closed` and `extra_items`) test assertions to match current behavior since these features aren't fully implemented yet. Each incorrect assertion is marked with a TODO comment describing the expected behavior once support is complete. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
Author
|
I'd actually be most interested in @sharkdp's review on this one 😃 |
Member
Author
|
For transparency: the title of the first commit ee79262 is "Claude's initial pass on a test suite". @carljm and I went through the spec and the conformance suite fairly exhaustively and added the subheadings for the tests we would like to add, and then had Claude write the actual tests based on those subheadings. I then went through Claude's tests and reviewed them for correctness, making fixes in subsequent commits. |
sharkdp
approved these changes
Mar 12, 2026
Contributor
sharkdp
left a comment
There was a problem hiding this comment.
Cool — thank you very much for the exhaustive tests!
Member
Author
|
Thank you for the equally exhaustive review! 😃 |
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.
Summary
This PR adds an initial test suite for
closed=Trueandextra_itemsTypedDicts, both originally introduced by PEP 728. The spec for TypedDicts is here, and the conformance-suite tests for PEP 728 features are here.Note that we already have some existing tests for the
closed=Truekeyword here:ruff/crates/ty_python_semantic/resources/mdtest/typed_dict.md
Lines 2927 to 2941 in 92a77f2
Test Plan
this pr is all tests
Co-authored-by: Carl Meyer [email protected]