diff options
| author | robot-piglet <[email protected]> | 2024-05-26 15:46:35 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2024-05-26 15:54:52 +0300 |
| commit | 187743291b2c746066e975e72d09b61004aebf54 (patch) | |
| tree | 379d8ecc9dbd00830787e43ff9b11b6a64a4e9a3 /contrib/python | |
| parent | a8996ae52690afda33ca6ffc87ace66f14cc036e (diff) | |
Intermediate changes
Diffstat (limited to 'contrib/python')
| -rw-r--r-- | contrib/python/freezegun/py3/.dist-info/METADATA | 2 | ||||
| -rw-r--r-- | contrib/python/freezegun/py3/freezegun/__init__.py | 2 | ||||
| -rw-r--r-- | contrib/python/freezegun/py3/freezegun/api.py | 24 | ||||
| -rw-r--r-- | contrib/python/freezegun/py3/ya.make | 2 |
4 files changed, 18 insertions, 12 deletions
diff --git a/contrib/python/freezegun/py3/.dist-info/METADATA b/contrib/python/freezegun/py3/.dist-info/METADATA index 339ddf25b03..c61e501f538 100644 --- a/contrib/python/freezegun/py3/.dist-info/METADATA +++ b/contrib/python/freezegun/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: freezegun -Version: 1.5.0 +Version: 1.5.1 Summary: Let your Python tests travel through time Home-page: https://github.com/spulec/freezegun Author: Steve Pulec diff --git a/contrib/python/freezegun/py3/freezegun/__init__.py b/contrib/python/freezegun/py3/freezegun/__init__.py index c2996b734e2..cab37a3f7e0 100644 --- a/contrib/python/freezegun/py3/freezegun/__init__.py +++ b/contrib/python/freezegun/py3/freezegun/__init__.py @@ -9,7 +9,7 @@ from .api import freeze_time from .config import configure __title__ = 'freezegun' -__version__ = '1.5.0' +__version__ = '1.5.1' __author__ = 'Steve Pulec' __license__ = 'Apache License 2.0' __copyright__ = 'Copyright 2012 Steve Pulec' diff --git a/contrib/python/freezegun/py3/freezegun/api.py b/contrib/python/freezegun/py3/freezegun/api.py index 0f11e0c113f..d2352926e46 100644 --- a/contrib/python/freezegun/py3/freezegun/api.py +++ b/contrib/python/freezegun/py3/freezegun/api.py @@ -509,10 +509,11 @@ class TickingDateTimeFactory: 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: - if isinstance(delta, numbers.Real): - # noinspection PyTypeChecker - self.move_to(self.time_to_freeze + datetime.timedelta(seconds=delta)) + def tick(self, delta: Union[datetime.timedelta, float]=datetime.timedelta(seconds=1)) -> datetime.datetime: + if isinstance(delta, numbers.Integral): + self.move_to(self.time_to_freeze + datetime.timedelta(seconds=int(delta))) + elif isinstance(delta, numbers.Real): + self.move_to(self.time_to_freeze + datetime.timedelta(seconds=float(delta))) else: self.move_to(self.time_to_freeze + delta) # type: ignore return self.time_to_freeze @@ -531,10 +532,11 @@ class FrozenDateTimeFactory: def __call__(self) -> datetime.datetime: return self.time_to_freeze - def tick(self, delta: Union[datetime.timedelta, int]=datetime.timedelta(seconds=1)) -> datetime.datetime: - if isinstance(delta, numbers.Real): - # noinspection PyTypeChecker - self.time_to_freeze += datetime.timedelta(seconds=delta) + def tick(self, delta: Union[datetime.timedelta, float]=datetime.timedelta(seconds=1)) -> datetime.datetime: + if isinstance(delta, numbers.Integral): + self.move_to(self.time_to_freeze + datetime.timedelta(seconds=int(delta))) + elif isinstance(delta, numbers.Real): + self.move_to(self.time_to_freeze + datetime.timedelta(seconds=float(delta))) else: self.time_to_freeze += delta # type: ignore return self.time_to_freeze @@ -557,9 +559,13 @@ class StepTickTimeFactory: self.tick() return return_time - def tick(self, delta: Union[datetime.timedelta, int, None]=None) -> 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, numbers.Integral): + delta = datetime.timedelta(seconds=int(delta)) + elif isinstance(delta, numbers.Real): + delta = datetime.timedelta(seconds=float(delta)) self.time_to_freeze += delta # type: ignore return self.time_to_freeze diff --git a/contrib/python/freezegun/py3/ya.make b/contrib/python/freezegun/py3/ya.make index 124a48d7716..fc4d4bf1ba3 100644 --- a/contrib/python/freezegun/py3/ya.make +++ b/contrib/python/freezegun/py3/ya.make @@ -4,7 +4,7 @@ PY3_LIBRARY() PROVIDES(freezegun) -VERSION(1.5.0) +VERSION(1.5.1) LICENSE(Apache-2.0) |
