@pytest.mark.parametrize(argnames=['sensor'], argvalues=[[lazy_fixture('pressure_sensor')], [lazy_fixture('capacitive_sensor')]])
async def test_threshold(sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMessageNotifier) -> None:
    'Test that data is received from the threshold function.'

    def responder(node_id: NodeId, message: MessageDefinition) -> None:
        'Message responder.'
        if isinstance(message, SetSensorThresholdRequest):
            can_message_notifier.notify(SensorThresholdResponse(payload=SensorThresholdResponsePayload(threshold=message.payload.threshold, sensor=SensorTypeField(sensor._sensor_type), sensor_id=SensorIdField(SensorId.S0), mode=message.payload.mode)), ArbitrationId(parts=ArbitrationIdParts(message_id=ReadFromSensorResponse.message_id, node_id=NodeId.host, function_code=0, originating_node_id=node_id)))
    threshold = SensorDataType.build([0, 5])
    mock_messenger.send.side_effect = responder
    return_data = (await sensor.send_zero_threshold(mock_messenger, NodeId.pipette_left, threshold, 10))
    assert (return_data == threshold)
Test that data is received from the threshold function.
@pytest.mark.parametrize(argnames=['sensor'], argvalues=[[lazy_fixture('pressure_sensor')], [lazy_fixture('capacitive_sensor')]])
async def test_threshold(sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMessageNotifier) -> None:
    

    def responder(node_id: NodeId, message: MessageDefinition) -> None:
        'Message responder.'
        if isinstance(message, SetSensorThresholdRequest):
            can_message_notifier.notify(SensorThresholdResponse(payload=SensorThresholdResponsePayload(threshold=message.payload.threshold, sensor=SensorTypeField(sensor._sensor_type), sensor_id=SensorIdField(SensorId.S0), mode=message.payload.mode)), ArbitrationId(parts=ArbitrationIdParts(message_id=ReadFromSensorResponse.message_id, node_id=NodeId.host, function_code=0, originating_node_id=node_id)))
    threshold = SensorDataType.build([0, 5])
    mock_messenger.send.side_effect = responder
    return_data = (await sensor.send_zero_threshold(mock_messenger, NodeId.pipette_left, threshold, 10))
    assert (return_data == threshold)