async def METHOD_NAME(
    mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMessageNotifier
) -> None:
    """Test that we can receive errors while monitoring for exceeded ratings."""
    subject = scheduler.SensorScheduler()
    stim_message = BindSensorOutputRequest(
        payload=BindSensorOutputRequestPayload(
            sensor=SensorTypeField(SensorType.pressure),
            sensor_id=SensorIdField(SensorId.S0),
            binding=SensorOutputBindingField(
                SensorOutputBinding.max_threshold_sync.value
            ),
        )
    )
    reset_message = BindSensorOutputRequest(
        payload=BindSensorOutputRequestPayload(
            sensor=SensorTypeField(SensorType.pressure),
            sensor_id=SensorIdField(SensorId.S0),
            binding=SensorOutputBindingField(SensorOutputBinding.none.value),
        )
    )
    # an error message is received
    async with subject.monitor_exceed_max_threshold(
        [
            sensor_types.SensorInformation(
                sensor_type=SensorType.pressure,
                sensor_id=SensorId.S0,
                node_id=NodeId.pipette_left,
            )
        ],
        mock_messenger,
    ) as output_queue:
        mock_messenger.ensure_send.assert_called_with(
            node_id=NodeId.pipette_left,
            message=stim_message,
            expected_nodes=[NodeId.pipette_left],
        )
        can_message_notifier.notify(
            ErrorMessage(
                payload=ErrorMessagePayload(
                    severity=ErrorSeverityField(ErrorSeverity.unrecoverable),
                    error_code=ErrorCodeField(ErrorCode.over_pressure),
                )
            ),
            ArbitrationId(
                parts=ArbitrationIdParts(
                    message_id=ErrorMessage.message_id,
                    node_id=NodeId.host,
                    originating_node_id=NodeId.pipette_left,
                    function_code=0,
                )
            ),
        )
    mock_messenger.ensure_send.assert_called_with(
        node_id=NodeId.pipette_left,
        message=reset_message,
        expected_nodes=[NodeId.pipette_left],
    )
    def _drain() -> Iterator[Tuple[NodeId, ErrorCode]]:
        while True:
            try:
                yield output_queue.get_nowait()
            except asyncio.QueueEmpty:
                break
    for _id, value in _drain():
        assert _id == NodeId.pipette_left
        assert value == ErrorCode.over_pressure
    mock_messenger.reset_mock()
    # no error message is received, the queue should be empty
    async with subject.monitor_exceed_max_threshold(
        [
            sensor_types.SensorInformation(
                sensor_type=SensorType.pressure,
                sensor_id=SensorId.S0,
                node_id=NodeId.pipette_left,
            )
        ],
        mock_messenger,
    ) as output_queue:
        mock_messenger.ensure_send.assert_called_with(
            node_id=NodeId.pipette_left,
            message=stim_message,
            expected_nodes=[NodeId.pipette_left],
        )
    mock_messenger.ensure_send.assert_called_with(
        node_id=NodeId.pipette_left,
        message=reset_message,
        expected_nodes=[NodeId.pipette_left],
    )
    with pytest.raises(asyncio.QueueEmpty):
        output_queue.get_nowait()