def test_set_op_type_error_out_for_const():
        """
        We cannot use set_op_type for const op
        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(1, 10, 30))], opset_version=ct.target.iOS16)
        def prog(x):
            add_const = np.random.rand(10, 30).astype(np.float32)
            return mb.add(x=x, y=add_const, name="add1")

        compressor = quantization.palettize_weights(
            config=cto.coreml.OptimizationConfig(
                global_config=cto.coreml.OpPalettizerConfig(
                    nbits=2, mode="KMEANS", weight_threshold=50
                ),
                op_type_configs={
                    "const": cto.coreml.OpPalettizerConfig(
                        nbits=4, mode="KMEANS", weight_threshold=50
                    )
                },
            )
        )

        with pytest.raises(
            ValueError,
            match="const ops cannot be set by the `set_op_type` function. Please use `set_global`",
        ):
            compressor.apply(prog)

        We cannot use set_op_type for const op
        
coremltools/test/optimize/coreml/test_passes.py