-
-
Notifications
You must be signed in to change notification settings - Fork 248
Description
Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.
Describe the bug
comparing datastructures that contain numbers and datetime.date objects raise a TypeError when certain flags related to number comparisons are set (e.g. math_epsilon).
it appears some values of the datetime module are treated as plain numbers
Line 109 in 81341e2
numbers = only_numbers + datetimes |
I assume this causes datetime.date to be compared by DeepDiff._diff_numbers rather than DeepDiff._diff_datetimes (as I would expect)
Line 1330 in 81341e2
self._diff_datetimes(level) |
To Reproduce
import datetime
from deepdiff import DeepDiff
# passes
DeepDiff(datetime.datetime(2022, 1, 1), datetime.datetime(2022, 1, 1), math_epsilon=0.001)
# raises TypeError: must be real number, not datetime.date
DeepDiff(datetime.date(2022, 1, 1), datetime.date(2022, 1, 1), math_epsilon=0.001)
Expected behavior
No exception should be raised, the values should be detected as equal/unchanged. flags that impact number comparisons (math_epsion, precision flags,...) should probably not impact datetime comparisons
OS, DeepDiff version and Python version (please complete the following information):
- DeepDiff 5.8.1
- Python 3.8
- OS: Ubuntu (running in WSL2)
- Version 18.04.5 LTS
Additional context
Add any other context about the problem here.