Add tests for get_in defaults, dissoc's size heuristic, and merge's kwarg error - #631
Open
drkoll wants to merge 1 commit into
Open
Add tests for get_in defaults, dissoc's size heuristic, and merge's kwarg error#631drkoll wants to merge 1 commit into
drkoll wants to merge 1 commit into
Conversation
…warg error Four tests covering behaviour that is currently executed by the suite but never checked: - merge's TypeError should name the keyword the caller actually passed - get_in's default/no_default paths, including a path that runs past a leaf - dissoc on both sides of its len(keys) < len(d)*.6 strategy switch, which the existing suite only exercises on one side Found with a mutation scan: mutating get_in's to left the previous suite green. All four pass on unmodified toolz.
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.
Four tests covering
dicttoolzbehaviour the suite currently executes but never checks.Found with a mutation scan. The one that prompted the rest: mutating
get_in'sreturn defaulttoreturn Noneleft the existing suite green, so nothing was asserting whatget_inreturns when a path is missing.What is added
merge'sTypeErrornames the keyword the caller actually passed (merge({1: 2}, factoryy=dict)should mentionfactoryy)get_indefaults: present path, missing key, missing intermediate, and explicitdefault=get_inwithno_default=True:KeyErroron a missing key,TypeErrorwhen a path runs past a leafdissocon both sides of itslen(keys) < len(d) * .6strategy switch — the existing tests only exercise one branch, and the two strategies must agreeNotes
test_dicttoolz.pypass on current master.dissoctest is a contract pin rather than a bug hunt: the heuristic is a performance choice and both branches are semantically identical, so the test asserts they agree rather than that either is right.Happy to split these up or adjust naming if you would prefer.