Skip to content

[Bug] Camel killer box and box dots gives unexpected behaviour #300

@antonymilne

Description

@antonymilne

Hello! Thank you for this awesome package. The combination of camel killer box and box dots does exactly what I'm looking for. Well, almost - there's a couple of behaviours that are not working quite as I expected. I'm not sure how many of these are bugs or just my expectations are wrong but hopefully you can explain!

from box import Box

b = Box({"someKey": ["a"]}, camel_killer_box=True, box_dots=True)
b["some_key"]
# works as expected: BoxList(['a'])

b["some_key[0]"]
# works as expected: 'a'

b["someKey"]
# works but I don't know if it should? From the docs it sounds like the original camel-case
# version should have been destroyed completely, but this gives BoxList(['a'])

b["someKey[0]"]
# raises BoxKeyError - not sure whether this should work, but given that just "someKey" worked above
# it feels inconsistent at any rate

b["SomeKey"]
# works but I wouldn't expect it to! Is this meant to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions