fix: re-align dead-band on sync

This commit is contained in:
Björn Stormwall
2026-06-06 19:19:22 +02:00
parent a695c47c62
commit 98466056c6
2 changed files with 19 additions and 7 deletions
+12 -1
View File
@@ -27,10 +27,21 @@ class TestShouldSend:
def test_first_run_always_sends(self, coord):
assert coord._should_send(8) is True
def test_same_value_no_send(self, coord):
def test_same_value_no_send_when_recent(self, coord):
coord._last_sent_current = 8
coord._last_sent_at = datetime.now(timezone.utc)
assert coord._should_send(8) is False
def test_same_value_sends_after_one_minute(self, coord):
coord._last_sent_current = 8
coord._last_sent_at = datetime.now(timezone.utc) - timedelta(minutes=1, seconds=1)
assert coord._should_send(8) is True
def test_zero_to_zero_never_resends(self, coord):
coord._last_sent_current = 0
coord._last_sent_at = datetime.now(timezone.utc) - timedelta(minutes=10)
assert coord._should_send(0) is False
def test_zero_to_nonzero_sends(self, coord):
coord._last_sent_current = 0
assert coord._should_send(8) is True