Skip to content

[Bug] Hashing of the number 1 and True produces inconsistent results #150

@Necrophagos

Description

@Necrophagos

Description

I have a weird behaviour with ignore_order=True where it sees a diff of two objects that are equal in my optinion

 a = {
    "A List": [
        {
            "Value One": True,
            "Value Two": 24,
            "Value Three": 1
        }
    ],
}

b = {
    "A List": [
        {
            "Value Two": 24,
            "Value Three": 1,
            "Value One": True
        }
    ],
}

from deepdiff import DeepDiff

diff_result = DeepDiff(a, b, ignore_order=True)
print(json.dumps(diff_result, indent=4))

produces

{
    "iterable_item_added": {
        "root['A List'][0]": {
            "Value Two": 24,
            "Value Three": 1,
            "Value One": true
        }
    },
    "iterable_item_removed": {
        "root['A List'][0]": {
            "Value One": true,
            "Value Two": 24,
            "Value Three": 1
        }
    }
}

The only difference is the order of the keys inside the dict.

The values also seem to be relevant. If I only assign numbers inside the dict then deepdiff detects that the objects are the same despite the order.

What do?

Environment

OS: Ubuntu 18.04.2 LTS
Python: Python 3.6.8
deepdiff==4.0.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions