def test_invalid_state_name_error_out(self, float32_buffer_model):
        """
        The conversion should error out if the user doesn't provide /
        or provides wrong name of the buffer
        """
        with pytest.raises(
            ValueError,
            match="StateType named None not provided or not found in the source torch model. Please make sure the name in 'ct.StateType\(name=..., wrapped_type=ct.TensorType\(...\)\)' match the 'named_buffers\(\)' in the source torch model.",
        ):
            prog = ct.convert(
                float32_buffer_model,
                inputs=[
                    ct.TensorType(shape=(3,)),
                ],
                states=[
                    ct.StateType(
                        wrapped_type=ct.TensorType(
                            shape=(3,),
                        )
                    ),
                ],
                minimum_deployment_target=ct.target.iOS18,
                compute_precision=ct.precision.FLOAT32,
                convert_to="milinternal",
            )

        with pytest.raises(
            ValueError,
            match="StateType named invalid not provided or not found in the source torch model. Please make sure the name in 'ct.StateType\(name=..., wrapped_type=ct.TensorType\(...\)\)' match the 'named_buffers\(\)' in the source torch model: \['state'\]",
        ):
            prog = ct.convert(
                float32_buffer_model,
                inputs=[
                    ct.TensorType(shape=(3,)),
                ],
                states=[
                    ct.StateType(wrapped_type=ct.TensorType(shape=(3,)), name="invalid"),
                ],
                minimum_deployment_target=ct.target.iOS18,
                compute_precision=ct.precision.FLOAT32,
                convert_to="milinternal",
            )

        The conversion should error out if the user doesn't provide /
        or provides wrong name of the buffer
        
coremltools/converters/mil/frontend/torch/test/test_torch_stateful_model.py