From 023c7a382fe15ba2f680b43de0e027c460ffc1ed Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Mon, 6 May 2024 09:18:35 +0200 Subject: [PATCH] Revert runtime type-check to `numbers.Real` --- freezegun/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freezegun/api.py b/freezegun/api.py index 8f0b755..4ac68d5 100644 --- a/freezegun/api.py +++ b/freezegun/api.py @@ -509,7 +509,7 @@ def __init__(self, time_to_freeze: datetime.datetime, start: datetime.datetime): def __call__(self) -> datetime.datetime: return self.time_to_freeze + (real_datetime.now() - self.start) - def tick(self, delta: Union[datetime.timedelta, int]=datetime.timedelta(seconds=1)) -> datetime.datetime: + def tick(self, delta: Union[datetime.timedelta, float]=datetime.timedelta(seconds=1)) -> datetime.datetime: if isinstance(delta, numbers.Real): # noinspection PyTypeChecker self.move_to(self.time_to_freeze + datetime.timedelta(seconds=delta)) @@ -532,7 +532,7 @@ def __call__(self) -> datetime.datetime: return self.time_to_freeze def tick(self, delta: Union[datetime.timedelta, float]=datetime.timedelta(seconds=1)) -> datetime.datetime: - if isinstance(delta, (int, float)): + if isinstance(delta, numbers.Real): # noinspection PyTypeChecker self.time_to_freeze += datetime.timedelta(seconds=delta) else: @@ -560,7 +560,7 @@ def __call__(self) -> datetime.datetime: def tick(self, delta: Union[datetime.timedelta, float, None]=None) -> datetime.datetime: if not delta: delta = datetime.timedelta(seconds=self.step_width) - elif isinstance(delta, (int, float)): + elif isinstance(delta, numbers.Real): delta = datetime.timedelta(seconds=delta) self.time_to_freeze += delta # type: ignore return self.time_to_freeze