deepdiff icon indicating copy to clipboard operation
deepdiff copied to clipboard

Error after comparing: Can not produce a hash (type datetime.date doesn't define __round__ method)

Open 36const opened this issue 1 year ago • 1 comments

DeepDiff has crashing comparing on the stage of hashes creating.

Compare two lists of dictionaries with type date and True for parameters ignore_order and ignore_numeric_type_changes:

import datetime

DeepDiff( [{'due_date': datetime.date(2024, 2, 1)}], [{'due_date': datetime.date(2024, 2, 2)}], ignore_order=True, ignore_numeric_type_changes=True )

Actual result: Can not produce a hash for root.Not counting this object. type datetime.date doesn't define round method Can not produce a hash for iterable root. type datetime.date doesn't define round method Can not produce a hash for root.Not counting this object. type datetime.date doesn't define round method Can not produce a hash for iterable root. type datetime.date doesn't define round method {}

image

Expected result: {'values_changed': {"root[0]['due_date']": {'new_value': datetime.date(2024, 2, 1), 'old_value': datetime.date(2024, 2, 2)}}}

Environment:

  • OS: Ubuntu
  • Version 22.04
  • Python Version 3.10.12
  • DeepDiff Version 6.7.1

36const avatar Jan 18 '24 14:01 36const

Hi @36const Thanks for reporting this bug. I will take a look at it when I have a chance. PRs are always very welcome too!

seperman avatar Feb 04 '24 06:02 seperman