Skip to content

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

Closed
@36const

Description

@36const

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions