Repository navigation
Add node-focused typing tests for tree utilities - #1011
Draft
tobiasraabe wants to merge 3 commits into
Draft
tobiasraabe wants to merge 3 commits into
tobiasraabe wants to merge 3 commits into
Conversation
This branch has not been deployed
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.
Changes
Add 19 pytest-typing cases for pytask nodes across tree utilities and plugin use cases: flat and nested containers, protocol-typed task dependencies/products, custom leaf predicates, worker product mapping, and structure comparisons.
Each case documents the intended types alongside assertions of the checkers' current revealed output. README-supported
only=blocks distinguish outputs where necessary. Related checker issues and expected diagnostics stay near their cases. Changes in inference fail the snapshot assertions for review against the intended types; there are no new xfail marks.Add node-specific overloads to
tree_leavesso individual nodes and flat lists, tuples, and dictionaries preserve their leaf types. Custom predicates retain the general fallback. Runtime traversal is unchanged. Add two narrow casts in execution to express the node-leaf contract, including concrete product leaves after provisional resolution. This addresses the execution errors surfaced by upgrading from ty 0.0.80 to 0.0.84; the PR base passes with 0.0.80 and reports these errors with 0.0.84.Configure ty as the default typing-test backend, include it in test dependencies, and upgrade the lockfile to ty 0.0.84.
Validation
just lint: passed.just test tests/test_typing_tree_util.md tests/test_typing_tree_util_plugins.md tests/test_typing_tree_util_structure.md tests/test_tree_util.py -q: 26 passed (19 typing cases and 7 runtime tests).--info reveal-type, because pytest-typing 26.3.0 does not enable these diagnostics itself.just typing: passed. Targeted execution, provisional-node, tree runtime, and typing tests: 107 passed.The passing typing tests record current behavior; they do not mean the documented inference gaps are resolved. In particular, nested leaf inference still needs improvement.
Todo