Repository navigation
Validate and reconstruct namedtuple fields in ExactSequence - #560
Open
xingzhao-ji wants to merge 1 commit into
Open
xingzhao-ji wants to merge 1 commit into
xingzhao-ji wants to merge 1 commit into
Conversation
xingzhao-ji
marked this pull request as ready for review
October 14, 2026 17:49
xingzhao-ji
marked this pull request as draft
October 14, 2026 17:50
xingzhao-ji
marked this pull request as ready for review
October 14, 2026 17:51
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.
ExactSequenceaccepts tuple inputs but reconstructs them withtype(value)(generator). For named tuples, this either raisesTypeError(zero or multiple fields) or silently stores the generator in a one-field record without validating its contents.Use the same named-tuple detection and positional reconstruction already used by ordinary tuple schemas. Keep ordinary list/tuple reconstruction and validation error handling unchanged.
Five regression cases cover zero-, one-, and two-field named tuples, coercion, preserving the record type and original input, and invalid fields with default/custom messages inside a dictionary schema. The API docstring and changelog describe the fix.
Validation:
git diff --checkpasses.Black, isort, flake8, and the full supported Python/OS matrix were not run in the existing environment. No claim of completed upstream CI is made.
This extends the existing named-tuple handling from #231 to
ExactSequence; it does not change unordered-sequence matching.