Skip to content

Match nested mapping values without reparsing stringified keys - #647

Open
ShahadatTest wants to merge 1 commit into
fabiocaccamo:mainfrom
ShahadatTest:fix/match-nested-mapping-values
Open

ShahadatTest wants to merge 1 commit into
fabiocaccamo:mainfrom
ShahadatTest:fix/match-nested-mapping-values

Conversation

@ShahadatTest

Copy link
Copy Markdown

Describe your changes

benedict.core.match({"a": {"b": 1}}, "a.b") currently returns [None], because generated keypaths are passed to plain dict.get(). Numeric dictionary keys also become strings before lookup: benedict({2: "two"}).match("*") returns [None].

Collect each original value alongside its formatted path, then sort and filter those pairs. This keeps literal separator/bracket keys and numeric keys attached to their values, supports nested mappings and list/tuple indexes, and preserves configured separators, path ordering and the indexes switch. No public signature changes.

Related issue

Newly reproduced; no overlapping open issue or PR found.

Validation

Three new regression methods fail on the original implementation. Full Python 3.12 unittest suite: 994 passed. Ruff lint/format, mypy on the changed module and git diff --check pass. The first full run overlapped another suite's downloads and hit a truncated shared XLSM fixture; the serial rerun above passed completely.

AI assistance

Prepared and tested with OpenAI Codex (GPT-6). Original user request: new 14ta koro aro (make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant