def test_ModelComponent_raises_if_exposed_input_keys_differ_from_decorated_method_parameters(
    lightning_squeezenet1_1_obj,
):
    """This occurs when the instance is being initialized.

    This is noted because it differs from some other metaclass validations which will raise an exception at class
    definition time.

    """
    from tests.core.serve.models import ClassificationInference

    class FailedExposedDecorator(ModelComponent):
        def __init__(self, model):
            self.model = model

        @expose(inputs={"NOT_NAMED": Number()}, outputs={"foo": Number()})
        def predict(self, param):
            return param

    comp = ClassificationInference(lightning_squeezenet1_1_obj)

    with pytest.raises(RuntimeError, match="`@expose` must list all method arguments"):
        _ = FailedExposedDecorator(comp)
This occurs when the instance is being initialized.

    This is noted because it differs from some other metaclass validations which will raise an exception at class
    definition time.

    
tests/core/serve/test_gridbase_validations.py