Skip to content

merge_update() not merging nested dictionaries or lists #253

@191801737

Description

@191801737

Does this make sense? I need it for myself, but maybe it's not box' responsibility.

(venv) > ipython
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
In [1]: import box

In [2]: box.__version__
Out[2]: '7.0.1'

In [3]: d1 = {'app': {'S3': {'S3Service': [{'bucket': 'bucket001'}]}}}

In [4]: d2 = {'app': {'S3': {'S3Service': [{'expirationDate': '2099-10-25'}]}}}

In [5]: box1 = box.Box(d1)

In [6]: box1.merge_update(d2, box_merge_lists='extend')

In [7]: box1
Out[7]: Box({'app': {'S3': {'S3Service': [{'expirationDate': '2099-10-25'}]}}})

I was expecting:

In [9]: box1
Out[9]: Box({'app': {'S3': {'S3Service': [{'bucket': "bucket001'"}, {'expirationDate': '2099-10-25'}]}}})

Can anyone help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions