Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

to_dict() fails to convert Addicts inside lists in lists #155

Open
ericjmcd opened this issue Oct 16, 2024 · 0 comments
Open

to_dict() fails to convert Addicts inside lists in lists #155

ericjmcd opened this issue Oct 16, 2024 · 0 comments

Comments

@ericjmcd
Copy link

I haven't tried to find all the corner cases, but a dictionary that has a list of lists with a value that is a dict, will correctly convert the inner dict into an Addict. However, when converting back to a pure dict with to_dict() the inner Addict is not converted.

addict version 2.4 in Python 3.12

from addict import Dict
orig = {'list': [[{'d': 1}]]}
conv = Dict(orig)
assert(isinstance(conv.list[0][0], Dict))  # Passes - inner dict becomes a Dict
final = conv.to_dict()
inner_dict = final['list'][0][0]
assert(not isinstance(inner_dict, Dict))  # Fails - inner dict is still a Dict
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant