in short, it should return self[item] instead of default
in details - if the value is dictionary, it is transformed to box internally in the "self[item] = default" call.
in this case, returning 'default' will return a detached empty dictionary that is usless
fixed code should look like:
def setdefault(self, item, default=None):
if item in self:
return self[item]
if isinstance(default, dict):
default = self._box_config["box_class"](default, **self.__box_config())
if isinstance(default, list):
default = box.BoxList(default, **self.__box_config())
self[item] = default
return self[item]
in short, it should return self[item] instead of default
in details - if the value is dictionary, it is transformed to box internally in the "self[item] = default" call. in this case, returning 'default' will return a detached empty dictionary that is usless
fixed code should look like: def setdefault(self, item, default=None): if item in self: return self[item]