code: def test_raises_invalid_metric(
      mock_logger: PicklableClientLogger,
      make_automl: Callable[..., AutoML],
      make_sklearn_dataset: Callable[..., XYDataManager],
  ) -> None:
      """
      Expects
      -------
      * Should raise an error if the given metric is not applicable to a given task type
      """
      # `precision` is not applicable to MULTICLASS_CLASSIFICATION
      dataset = "iris"
      task = MULTICLASS_CLASSIFICATION
      metrics = [accuracy, precision]
  
      automl = make_automl(metrics=metrics)
      automl._logger = mock_logger
  
      datamanager = make_sklearn_dataset(
          dataset,
          as_datamanager=True,
          task=task,
          feat_type="numerical",
      )
      automl._backend.save_datamanager(datamanager)
  
      with pytest.raises(
          ValueError,
          match="Are you sure precision is applicable for the given task type",
      ):
          automl._do_dummy_prediction()
  
file_path: auto-sklearn/test/test_automl/test_dummy_predictions.py
imports: from __future__ import annotations
  from typing import Callable, Sequence, Tuple
  from pathlib import Path
  import numpy
  from smac.tae import StatusType
  from autosklearn.automl import AutoML
  from autosklearn.constants import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION
  from autosklearn.data.xy_data_manager import XYDataManager
  from autosklearn.metrics import Scorer, accuracy, log_loss, precision, r2
  from autosklearn.util.logging_ import PicklableClientLogger
  import pytest
  from pytest_cases import parametrize
  from unittest.mock import patch
label_desc: Use image node_id 5 for calling a global function with example usage: test_raises_invalid_metric(mock_logger, make_automl, make_sklearn_dataset) without return types