code: def test_compute_metric_unsupported_sample_weight(dataset, caplog):
      """Test if a warning message is displayed when the metric does not support sample weight."""
      y_true = dataset["regression"]["y_true"]
      y_pred = dataset["regression"]["y_pred"]
      sample_weight = dataset["sample_weight"]
  
      metric = PermutationImportance._compute_metric(
          metric_fn=max_error,
          y=y_true,
          y_hat=y_pred,
          sample_weight=sample_weight,
      )
  
      expected_max_error = max_error(y_true=y_true, y_pred=y_pred)
  
      assert np.isclose(expected_max_error, metric)
      assert re.search(
          "The loss function .+ does not support argument `sample_weight`.",
          caplog.text,
      )
  
imports: import re
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.metrics import accuracy_score, f1_score, max_error
  from alibi.api.defaults import DEFAULT_DATA_PERMUTATION_IMPORTANCE, DEFAULT_META_PERMUTATION_IMPORTANCE
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PermutationImportance, plot_permutation_importance
label_desc: Use image node_id 5 for calling a global function with example usage: test_compute_metric_unsupported_sample_weight(dataset, caplog) without return types