code: def test__plot_hbar_values(
      sort, top_k, target, features, exp_importance
  ):
      """Test if the plotted values, labels and titles are correct on the bar plot."""
      ax = _plot_hbar(
          exp_values=exp_importance.data["feature_importance"],
          exp_feature_names=exp_importance.data["feature_names"],
          exp_target_names=exp_importance.meta["params"][
              "target_names"
          ],
          targets=[target],
          features=features,
          sort=sort,
          top_k=top_k,
      ).ravel()
  
      datavalues = ax[0].containers[0].datavalues
      expected_datavalues = np.array(
          [
              exp_importance.data["feature_importance"][target][ft]
              for ft in features
          ]
      )
  
      feature_names = [
          txt.get_text() for txt in ax[0].get_yticklabels()
      ]
      expected_feature_names = [
          exp_importance.data["feature_names"][ft] for ft in features
      ]
  
      if sort:
          sorted_idx = np.argsort(expected_datavalues)[::-1][:top_k]
          expected_datavalues = expected_datavalues[sorted_idx]
          expected_feature_names = [
              expected_feature_names[i] for i in sorted_idx
          ]
  
      assert np.allclose(datavalues, expected_datavalues)
      assert feature_names == expected_feature_names
      assert (
          ax[0].get_title()
          == exp_importance.meta["params"]["target_names"][target]
      )
  
imports: import re
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.ensemble import GradientBoostingRegressor
  from sklearn.linear_model import LinearRegression
  from alibi.api.defaults import DEFAULT_DATA_PDVARIANCE, DEFAULT_META_PDVARIANCE
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PartialDependence, PartialDependenceVariance, TreePartialDependence
  from alibi.explainers.pd_variance import _plot_feature_importance, _plot_feature_interaction, _plot_hbar, plot_pd_variance
label_desc: Use image node_id 19 for calling a global function with example usage: test__plot_hbar_values(sort, top_k, target, features, exp_importance) without return types