summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-20 05:58:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-20 05:58:27 +0000
commite67de01f39ed7cc752e4e209d82f431872cd0d06 (patch)
tree229f014c0b63e4831f8ea9e2d345ddf26d50bd3d /tests
parentAdding upstream version 1.14.1. (diff)
downloadiredis-e67de01f39ed7cc752e4e209d82f431872cd0d06.tar.xz
iredis-e67de01f39ed7cc752e4e209d82f431872cd0d06.zip
Adding upstream version 1.15.0.upstream/1.15.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/unittests/test_completers.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/unittests/test_completers.py b/tests/unittests/test_completers.py
index 5441b0e..71f0234 100644
--- a/tests/unittests/test_completers.py
+++ b/tests/unittests/test_completers.py
@@ -1,6 +1,6 @@
-from unittest.mock import MagicMock, patch
+from unittest.mock import MagicMock
-import pendulum
+from freezegun import freeze_time
from prompt_toolkit.formatted_text import FormattedText
from prompt_toolkit.completion import Completion
@@ -180,9 +180,8 @@ def test_group_completer():
]
-@patch("iredis.completers.pendulum.now")
-def test_timestamp_completer_humanize_time_completion(fake_now):
- fake_now.return_value = pendulum.from_timestamp(1578487013)
+@freeze_time("2020-01-08 12:36:53")
+def test_timestamp_completer_humanize_time_completion():
c = TimestampCompleter(is_milliseconds=True, future_time=False)
fake_document = MagicMock()
@@ -260,9 +259,8 @@ def test_timestamp_completer_humanize_time_completion(fake_now):
]
-@patch("iredis.completers.pendulum.now")
-def test_timestamp_completer_humanize_time_completion_seconds(fake_now):
- fake_now.return_value = pendulum.from_timestamp(1578487013)
+@freeze_time("2020-01-08 12:36:53")
+def test_timestamp_completer_humanize_time_completion_seconds():
c = TimestampCompleter(is_milliseconds=False, future_time=False)
fake_document = MagicMock()
@@ -297,9 +295,8 @@ def test_timestamp_completer_humanize_time_completion_seconds(fake_now):
]
-@patch("iredis.completers.pendulum.now")
-def test_timestamp_completer_humanize_time_completion_seconds_future_time(fake_now):
- fake_now.return_value = pendulum.from_timestamp(1578487013)
+@freeze_time("2020-01-08 12:36:53")
+def test_timestamp_completer_humanize_time_completion_seconds_future_time():
c = TimestampCompleter(is_milliseconds=False, future_time=True)
fake_document = MagicMock()
@@ -350,7 +347,7 @@ def test_timestamp_completer_datetime_format_time_completion():
text="1581033600000",
start_position=-10,
display=FormattedText([("", "1581033600000")]),
- display_meta="2020-02-07T00:00:00+00:00",
+ display_meta="2020-02-07 00:00:00+00:00",
)
]