Skip to content

if dict's key started with __, deepdiff wont work #565

@towingie

Description

@towingie

Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.

Describe the bug
if dict's key name started with __, DeepDiff behaves unexpectedly

To Reproduce

>>> b = {'a':{'aa':{ 'aaa':{'aaaa':{"cccc":2, "eeee":2}}}}}
>>> a = {'a':{'aa':{ 'aaa':{'aaaa':{"cccc":2}}}}}
>>> DeepDiff(a,b, ignore_order=True)
{'dictionary_item_added': ["root['a']['aa']['aaa']['aaaa']['eeee']"]}
>>> a = {'a':{'aa':{ 'aaa':{'__aaaa':{"cccc":2}}}}}
>>> b = {'a':{'aa':{ 'aaa':{'__aaaa':{"cccc":2, "eeee":2}}}}}
>>> DeepDiff(a,b, ignore_order=True)
{}
>>> a = {'__abc':1}
>>> b = {'__abc':2}
>>> DeepDiff(a,b, ignore_order=True)
{}

Expected behavior
A clear and concise description of what you expected to happen.

OS, DeepDiff version and Python version (please complete the following information):

  • OS: MacOS/Linux tested
  • Version 15.6.1 / Gentoo
  • Python Version 3.11
  • DeepDiff Version 8.6.0

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