Improved code quality with more idiomatic Python patterns.
CD / Build (push) Successful in 7s
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (push) Successful in 11s
CI / Type Checking (push) Successful in 20s
CI / Spelling (push) Successful in 32s

This commit is contained in:
2026-03-24 11:02:13 -04:00
parent 653c27c97c
commit 295a8c90a9
10 changed files with 201 additions and 292 deletions
+3 -3
View File
@@ -62,7 +62,7 @@ class TestCanNotify:
service = _make_service(
client=_StubMatrixClient(), subscription_repo=subscription_repo
)
service.notification_timers_cache["example.com"] = time.time()
service.notification_timers_cache["example.com"] = time.monotonic()
assert service._can_notify("example.com") is False
def test_after_cooldown_allowed(
@@ -74,7 +74,7 @@ class TestCanNotify:
)
# Subtract an extra second to ensure the cooldown has fully elapsed
service.notification_timers_cache["example.com"] = (
time.time() - SECONDS_BETWEEN_NOTIFICATIONS - 1
time.monotonic() - SECONDS_BETWEEN_NOTIFICATIONS - 1
)
assert service._can_notify("example.com") is True
@@ -253,7 +253,7 @@ class TestNotifyStreamLive:
"""Skip sending when the domain is within the rate-limit cooldown."""
client = _StubMatrixClient()
service = _make_service(client=client, subscription_repo=subscription_repo)
service.notification_timers_cache["example.com"] = time.time()
service.notification_timers_cache["example.com"] = time.monotonic()
await stream_repo.create("example.com")
await subscription_repo.add("example.com", "!room1:matrix.org")