Repository navigation
Handle dictionary keys that cannot be sorted in has_entries - #279
Open
ryanduguid wants to merge 1 commit into
Open
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
Keep the original item snapshot when sorting raises TypeError, while preserving sorted order when comparisons succeed. Cover diagnostic and evaluation order, one-shot items and exception boundaries, and add the required changelog fragment for issue 271.
ryanduguid
requested a deployment
to
publish-test-release
October 8, 2026 10:12 — with
GitHub Actions
Waiting
This branch is waiting to be 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.
Summary
Allow
has_entriesto match dictionaries with mixed or unordered keys, including frozen dataclass instances. Preserve sorted descriptions and matcher evaluation order when sorting succeeds; use the original item order when comparisons raiseTypeError.Fixes #271. Add ten regression tests and a changelog fragment.
Evidence
TypeErrorduring construction.After: The focused suite passes all 27 tests. Coverage includes descriptions, first mismatch, evaluation order, input preservation, one-shot item iteration and exception boundaries.
uv tool run tox -s: all 20 configured environments pass, including typing, lint, documentation, package description, changelog and coverage. CPython 3.10 through 3.14 each passes 456 tests with 14 NumPy skips, or 470 with NumPy. The four PyPy aliases each pass 448 tests with 15 skips and all resolve to PyPy 3.10.16.Merge danger
Door: Two-way. Blast radius: Matcher consumers.
The fallback also absorbs
TypeErrorraised by a custom comparison method. Errors from obtaining or materialising items, other comparison exceptions and value matcher exceptions still propagate. Fallback descriptions and the first mismatch follow the supplied item order.Unverified
PyPy 3.11 and NumPy on PyPy were not exercised by the resolved local matrix. macOS, other Windows interpreters and the Windows typing/docs/package matrix were not run. Documentation warnings were not compared with the baseline. Only Python 3.14 has a full baseline suite comparison. Independent execution of the verification scripts, scanner version/parser coverage, hosted CI and maintainer acceptance remain unverified.