def metric_instance(metric_init_params_lookup, metric_init_final_attributes_lookup, request):
    """Instance of `metrics.Metric` initialized with the corresponding values in
    `metric_init_params_lookup`"""
    metric = Metric(*metric_init_params_lookup[request.param])

    #################### Ensure Attributes Properly Initialized ####################
    (_name, _metric_function, _direction) = metric_init_final_attributes_lookup[request.param]
    assert metric.metric_function == _metric_function
    assert metric.direction == _direction
    assert str(metric) == "Metric({}, {}, {})".format(_name, _metric_function.__name__, _direction)

    return metric
def test_metric_initialization_invalid_direction(direction):
    with pytest.raises(ValueError, match="`direction` must be 'infer', 'max', or 'min', not .*"):
        Metric("some_metric", roc_auc_score, direction)