def test_invalid_deployment_target_error_out(self, float32_buffer_model):
        """
        The conversion should error out if the user tries to convert it
        into deployment target < ioS18.
        """
        with pytest.raises(
            ValueError,
            match="State model is supported only >= iOS18. Please update the minimum_deployment_target to at least coremltools.target.iOS18",
        ):
            prog = ct.convert(
                float32_buffer_model,
                inputs=[
                    ct.TensorType(shape=(3,)),
                ],
                states=[
                    ct.StateType(
                        wrapped_type=ct.TensorType(
                            shape=(3,),
                        ),
                        name="state",
                    ),
                ],
                minimum_deployment_target=ct.target.iOS17,
            )

        with pytest.raises(
            ValueError,
            match="State model is supported only >= iOS18. Please update the minimum_deployment_target to at least coremltools.target.iOS18",
        ):
            prog = ct.convert(
                float32_buffer_model,
                inputs=[
                    ct.TensorType(shape=(3,)),
                ],
                states=[
                    ct.StateType(
                        wrapped_type=ct.TensorType(
                            shape=(3,),
                        ),
                        name="state",
                    ),
                ],
                convert_to="neuralnetwork",
            )

        The conversion should error out if the user tries to convert it
        into deployment target < ioS18.
        
coremltools/converters/mil/frontend/torch/test/test_torch_stateful_model.py