This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hildogjr
Recipients hildogjr
Date 2020-09-14.20:57:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600117029.56.0.0494687927822.issue41785@roundup.psfhosted.org>
In-reply-to
Content
I am running a test

`self.assertAlmostEqual(date1, date2, 6)`

and getting the result:

ERROR: test_datetime_linspace (__main__.TestFunctions)
Check the linspace object output type and delta between them.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/lab/Documents/UNICAMP/LabREI/web-visualization/tests/test_interpreter.py", line 87, in test_datetime_linspace
    self.assertAlmostEqual(time_list[-1], now, 6)
  File "/usr/lib/python3.8/unittest/case.py", line 957, in assertAlmostEqual
    if round(diff, places) == 0:
TypeError: type datetime.timedelta doesn't define __round__ method


Despite the definition

@overload
    def assertAlmostEqual(self, first: datetime.datetime, second: datetime.datetime,
                          places: int = ..., msg: Any = ...,
                          delta: datetime.timedelta = ...) -> None: ...

on file case.pyi, the case.py doesn't deal good with `if round(diff, places) == 0:`, with `diff` the difference between the two varaibles.
History
Date User Action Args
2020-09-14 20:57:09hildogjrsetrecipients: + hildogjr
2020-09-14 20:57:09hildogjrsetmessageid: <1600117029.56.0.0494687927822.issue41785@roundup.psfhosted.org>
2020-09-14 20:57:09hildogjrlinkissue41785 messages
2020-09-14 20:57:09hildogjrcreate