Skip to content

Datetime dictionary keys cause entire path to be None #260

@laundmo

Description

@laundmo

Describe the bug
When comparing 2 dictionaries with datetimes as keys, the path becomes None.

To Reproduce

from deepdiff import DeepDiff
from datetime import datetime, timedelta as td

now = datetime.now()
a = {now: 1, now+td(1): 2}
b = {now: 2, now+td(1): 4}
diff = DeepDiff(a, b)
print(diff)
print(diff.pretty())

result

{'values_changed': {None: {'new_value': 4, 'old_value': 2}}}
Value of None changed from 1 to 2.
Value of None changed from 2 to 4.

Expected behavior
i expected the deepdiff to properly check whether 2 datetimes are the same or not, ans give me the datetime __repr__ or __str__ in the path instead of None

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

  • DeepDiff version: 5.5.0
  • Python version: Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
  • OS: Windows 10 10.0.19042 Build 19042

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions