class_docstr: K-Elbow Visualizer Tests
class_docstr_tok: ["K-Elbow","Visualizer","Tests"]
docstr: Test the manhattan distance metric of the distortion metric of the k-elbow visualizer
code: def test_distance_metric(self):
      """
      Test the manhattan distance metric of the distortion metric of the k-elbow visualizer
      """
      visualizer = KElbowVisualizer(
          KMeans(random_state=0),
          k=5,
          metric="distortion",
          distance_metric="manhattan",
          timings=False,
          locate_elbow=False,
      )
      visualizer.fit(self.clusters.X)
      assert len(visualizer.k_scores_) == 4
      assert visualizer.elbow_value_ is None
  
      expected = np.array(
          [189.060129, 154.096223, 124.271208, 107.087566]
      )
  
      visualizer.finalize()
      self.assert_images_similar(visualizer)
      assert_array_almost_equal(visualizer.k_scores_, expected)
  
imports: import sys
  import pytest
  import numpy
  import matplotlib.pyplot
  from scipy.sparse import csc_matrix, csr_matrix
  from numpy.testing import assert_array_almost_equal
  from sklearn.datasets import make_blobs
  from sklearn.cluster import KMeans, MiniBatchKMeans
  from sklearn.feature_extraction.text import TfidfVectorizer
  from tests.fixtures import Dataset
  from tests.base import VisualTestCase
  from yellowbrick.datasets import load_hobbies
  from yellowbrick.cluster.elbow import distortion_score
  from yellowbrick.cluster.elbow import KElbowVisualizer, kelbow_visualizer
  from yellowbrick.exceptions import YellowbrickValueError, YellowbrickWarning
  from tests.base import IS_WINDOWS_OR_CONDA
label_desc: Use image node_id 9 for calling the TestKElbowVisualizer obj's underlying member method code with example usage: obj.test_distance_metric() without return types