Repository navigation
Keep the box configuration on Box.get() dict and list defaults - #364
Open
EnesKartal wants to merge 1 commit into
Open
EnesKartal wants to merge 1 commit into
EnesKartal wants to merge 1 commit into
Conversation
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.
Box.get(key, default)converts a plaindict/listdefault into aBox/BoxList, but it builds them with no options, so the returned value loses the parent's configuration (box_dots,default_box,camel_killer_box,frozen_box, ...) and is always a plainBoxeven for subclasses.setdefault()already passes the parent config through, so the two disagree:The fix builds the default the same way
setdefault()does:box_classwithself.__box_config(extra_namespace=key), andBoxListwith the same config. The default is still not stored in the box.Test plan
test_get_default_keeps_box_config(box_dots path, camel_killer attribute, default_box lookup, BoxList default, subclass type, key not stored).1 failed, 28 passedforpytest test/test_box.py -k get(BoxKeyError: "'a.b'").pytest test/gives1210 passed; the only failures are the 6toontests that also fail onmasterwithout the optional toon dependency installed.ruff check/ruff format --checkpass.