code: def test_metrics(
      metric: ClassificationMetricsEnum,
      pipeline_func: Callable[[], Pipeline],
      data_setup: Tuple[InputData, InputData, str, Union[int, None]],
      expected_values: Dict[str, Dict[str, float]],
  ):
      set_random_seed(0)
      update_expected_values: bool = False
  
      train, test, task_type, validation_blocks = data_setup
  
      pipeline = pipeline_func()
      pipeline.fit(input_data=train)
      metric_function = MetricsRepository.get_metric(metric)
      metric_class = MetricsRepository.get_metric_class(metric)
      metric_value = metric_function(
          pipeline=pipeline,
          reference_data=test,
          validation_blocks=validation_blocks,
      )
  
      if not update_expected_values:
          expected_value = expected_values[task_type][str(metric)]
          assert np.isclose(
              metric_value, expected_value, rtol=0.001, atol=0.001
          )
          assert not np.isclose(
              metric_value,
              metric_class.default_value,
              rtol=0.01,
              atol=0.01,
          )
      else:
          with open(
              fedot_project_root()
              / "test/data/expected_metric_values.json",
              "w",
          ) as f:
              expected_values[task_type] = (
                  expected_values.get(task_type) or {}
              )
              expected_values[task_type][str(metric)] = metric_value
              json.dump(expected_values, f, indent=2)
          raise ValueError(
              "The value of `update_expected_values` should equal to `False` "
              "in order for this test to pass."
          )
  
imports: import json
  import sys
  from itertools import product
  from typing import Callable, Dict, Tuple, Union
  import numpy
  import pandas
  import pytest
  from sklearn.datasets import load_breast_cancer, load_diabetes, load_linnerud, load_wine
  from fedot.core.composer.metrics import QualityMetric, ROCAUC
  from fedot.core.data.data import InputData, OutputData
  from fedot.core.data.data_split import train_test_data_setup
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, ComplexityMetricsEnum, MetricsRepository, RegressionMetricsEnum, TimeSeriesForecastingMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum, TsForecastingParams
  from fedot.core.utils import fedot_project_root, set_random_seed
label_desc: Use image node_id 6 for calling a global function with example usage: test_metrics(metric, pipeline_func, data_setup, expected_values) without return types