Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Oct 10, 2024
1 parent 9a7f6d1 commit 1d81ba0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/HABApp/core/lib/instant_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1d81ba0

Please sign in to comment.