Skip to content

Commit

Permalink
Revert runtime type-check to numbers.Real
Browse files Browse the repository at this point in the history
  • Loading branch information
robsdedude committed May 6, 2024
1 parent be779f4 commit 023c7a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions freezegun/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 023c7a3

Please sign in to comment.