code: def test_calculate_metric():
      # metric to be maximized
      y_pred = np.array([0, 1, 0, 1, 1, 1, 0, 0, 0, 0])
      y_true = np.array([0, 1, 0, 1, 1, 0, 0, 0, 0, 0])
      score = sklearn.metrics.accuracy_score(y_true, y_pred)
      assert pytest.approx(score) == compute_single_metric(
          solution=y_true,
          prediction=y_pred,
          task_type=BINARY_CLASSIFICATION,
          metric=autosklearn.metrics.accuracy,
      )
  
      # metric to be minimized
      y_true = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])
      y_pred = np.array([0.11, 0.22, 0.33, 0.44, 0.55, 0.66])
      score = sklearn.metrics.mean_squared_error(y_true, y_pred)
      assert pytest.approx(score) == compute_single_metric(
          solution=y_true,
          prediction=y_pred,
          task_type=REGRESSION,
          metric=autosklearn.metrics.mean_squared_error,
      )
  
imports: import warnings
  import numpy
  import sklearn.metrics
  import autosklearn.metrics
  from autosklearn.constants import BINARY_CLASSIFICATION, REGRESSION
  from autosklearn.metrics import calculate_losses, calculate_scores, compute_single_metric
  import pytest
  import unittest
label_desc: Use image node_id 10 for calling a global function with example usage: test_calculate_metric() without return types