Skip to content

Does not work for more than three root items #555

Closed
@ar19517

Description

@ar19517

Describe the bug
Stops working if the number of root items grows

To Reproduce

t1 = {
    "a": {
        "z": [{"a": ["1"], "b": ["2"]}],
        "y": ["a"],
        "x": [],
    },
    "b": "1",
    "c": "1",
}
t2 = {
    "a": {
        "z": [{"a": ["3"], "b": ["2"]}],
        "y": ["b"],
        "x": [],
    },
}
print( DeepDiff(t1, t2, ignore_order=True, verbose_level=2).get_stats() )

works as expected and outputs:
{'PASSES COUNT': 7, 'DIFF COUNT': 31, 'DISTANCE CACHE HIT COUNT': 0, 'MAX PASS LIMIT REACHED': False, 'MAX DIFF LIMIT REACHED': False}

but if I add one more root item

t1 = {
    "a": {
        "z": [{"a": ["1"], "b": ["2"]}],
        "y": ["a"],
        "x": [],
    },
    "b": "1",
    "c": "1",
    "d": "1",
}
t2 = {
    "a": {
        "z": [{"a": ["3"], "b": ["2"]}],
        "y": ["b"],
        "x": [],
    },
}
print( DeepDiff(t1, t2, ignore_order=True, verbose_level=2).get_stats() )

it fails

{'PASSES COUNT': 0, 'DIFF COUNT': 1, 'DISTANCE CACHE HIT COUNT': 0, 'MAX PASS LIMIT REACHED': False, 'MAX DIFF LIMIT REACHED': False}

Expected behavior
I expect, that the diff count increases by one

OS, DeepDiff version and Python version:

  • OS: macOS
  • Version 15.5
  • Python Version 13.3
  • DeepDiff Version 8.5.0

Additional context

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