def test_idle_timer(self):
        user_id = "@foo:bar"
        now = 5000000

        state = UserPresenceState.default(user_id)
        state = state.copy_and_replace(
            state=PresenceState.ONLINE,
            last_active_ts=now - IDLE_TIMER - 1,
            last_user_sync_ts=now,
        )

        new_state = handle_timeout(
            state, is_mine=True, user_to_num_current_syncs={}, now=now
        )

        self.assertIsNotNone(new_state)
        self.assertEquals(new_state.state, PresenceState.UNAVAILABLE)
dataset/ETHPy150Open matrix-org/synapse/tests/handlers/test_presence.py/PresenceTimeoutTestCase.test_idle_timer/original