From 1d81ba0dbd423753ed175707f6c055796d6b7ac6 Mon Sep 17 00:00:00 2001 From: spacemanspiff2007 <10754716+spacemanspiff2007@users.noreply.github.com> Date: Thu, 10 Oct 2024 04:17:37 +0200 Subject: [PATCH] fixed test --- src/HABApp/core/lib/instant_view.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/HABApp/core/lib/instant_view.py b/src/HABApp/core/lib/instant_view.py index 95d09336..d97944a2 100644 --- a/src/HABApp/core/lib/instant_view.py +++ b/src/HABApp/core/lib/instant_view.py @@ -60,7 +60,10 @@ def _cmp(self, op: Callable[[Any, Any], bool], obj: HINT_OBJ | None, **kwargs: f case str(): td = TimeDelta.parse_common_iso(obj) case Instant(): - return op(self._instant, obj) + # If the compare the instant the logic is the other way around + # view > delta(3) -> view older than 3 seconds + # view > instant(-3) -> view newer than 3 seconds + return {ge: le, gt: lt, le: ge, lt: gt}[op](self._instant, obj) case _: msg = f'Invalid type: {type(obj).__name__}' raise TypeError(msg)