Repository navigation
Raise KeyError for missing keys in values() - #41
Open
Zhuyuyangyy wants to merge 1 commit into
Open
Zhuyuyangyy wants to merge 1 commit into
Zhuyuyangyy wants to merge 1 commit into
Conversation
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.
Change
values(key)is documented to raiseKeyErrorwhen an explicitly supplied key is missing. Currently it falls through to the no-argument path and returns values for unrelated keys instead:Keep the existing no-argument and present-key paths, and raise
KeyError(key)for the missing-key case. The regression covers empty/non-empty dictionaries, repeated values for an existing key, and validNone/Falsekeys. No other methods, dependencies or versions change.Local validation
python -m nose --exe): 56 tests pass on each of CPython 3.8.20 and 3.9.25.git diff --checkpasses.Quality-check caveat: modern Flake8 7.5.0 reports five existing F401 imports on unchanged line 25; mypy 2.4.1 (with six stubs) reports an existing
object.valueerror on line 396. Both outputs are byte-for-byte identical on the original HEAD and this patch. I have not bundled unrelated cleanup into this fix. The full tox interpreter matrix and upstream CI have not been run locally.AI assistance was used for the investigation, implementation and tests; the final diff and local results were checked before submission.