from __future__ import annotations from bot import polling_is_stuck def test_polling_is_stuck_for_unprocessed_updates() -> None: assert ( polling_is_stuck( now=1000.0, last_update_at=100.0, pending_update_count=2, stuck_after=300.0, ) is True ) def test_polling_is_not_stuck_without_pending_updates() -> None: assert ( polling_is_stuck( now=1000.0, last_update_at=100.0, pending_update_count=0, stuck_after=300.0, ) is False ) def test_polling_is_not_stuck_after_recent_update() -> None: assert ( polling_is_stuck( now=1000.0, last_update_at=900.0, pending_update_count=2, stuck_after=300.0, ) is False )