Author iritkatriel
Recipients hildogjr, iritkatriel
Date 2020-09-14.21:04:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600117486.46.0.520223857312.issue41785@roundup.psfhosted.org>
In-reply-to
Content
You need to pass the delta in as a kwarg:

https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual

>>> unittest.TestCase().assertAlmostEqual( datetime.date(2020,1,5),  datetime.date(2020,1,2), delta=datetime.timedelta(2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\src\cpython\lib\unittest\case.py", line 893, in assertAlmostEqual
    raise self.failureException(msg)
AssertionError: datetime.date(2020, 1, 5) != datetime.date(2020, 1, 2) within datetime.timedelta(days=2) delta (datetime.timedelta(days=3) difference)
>>> unittest.TestCase().assertAlmostEqual( datetime.date(2020,1,5),  datetime.date(2020,1,2), delta=datetime.timedelta(3))
>>>
History
Date User Action Args
2020-09-14 21:04:46iritkatrielsetrecipients: + iritkatriel, hildogjr
2020-09-14 21:04:46iritkatrielsetmessageid: <1600117486.46.0.520223857312.issue41785@roundup.psfhosted.org>
2020-09-14 21:04:46iritkatriellinkissue41785 messages
2020-09-14 21:04:46iritkatrielcreate