def METHOD_NAME():
    @resource(config_schema={"foo": str})
    def resource_reqs_config(context):
        assert context.resource_config["foo"] == "bar"
        return 5
    # Ensure that error is raised when we attempt to invoke with a None context
    with pytest.raises(
        DagsterInvalidInvocationError,
        match="Resource has required config schema, but no context was provided.",
    ):
        resource_reqs_config(None)
    # Ensure that error is raised when context does not have the required config.
    context = build_init_resource_context()
    with pytest.raises(
        DagsterInvalidConfigError,
        match="Error in config for resource",
    ):
        resource_reqs_config(context)
    with pytest.raises(
        DagsterInvalidConfigError,
        match="Error when applying config mapping for resource",
    ):
        resource_reqs_config.configured({"foobar": "bar"})(None)
    # Ensure that if you configure the respirce, you can provide a none-context.
    result = resource_reqs_config.configured({"foo": "bar"})(None)
    assert result == 5
    result = resource_reqs_config(build_init_resource_context(config={"foo": "bar"}))
    assert result == 5