spulec/freezegun

'FakeDatetime' object cannot be interpreted as an integer

Woody1193 opened this issue · 0 comments

When trying to run the following code:

def ceil_dt(time: datetime, delta: timedelta) -> datetime:
    return time + (datetime.min - time) % delta

@freezetime("2023-10-17 16:27:59")
def test():
    ceil_dt(datetime.now(), timedelta(minutes = 30)) == datetime(2023, 10, 17, 16, 30, 0)

I get the following error:

TypeError: 'FakeDatetime' object cannot be interpreted as an integer

Seems that this should work as expected since datetime objects wrap integers.