Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
36const opened this issue Jan 18, 2024 · 1 comment · Fixed by #449
Assignees
Labels

Comments

@36const
Copy link

36const commented Jan 18, 2024

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
@seperman
Copy link
Owner

seperman commented Feb 4, 2024

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 seperman self-assigned this Feb 4, 2024
@seperman seperman added the bug label Feb 4, 2024
@seperman seperman mentioned this issue Apr 5, 2024
12 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants