class_docstr: Test the InterclusterDistance visualizer
class_docstr_tok: ["Test","the","InterclusterDistance","visualizer"]
docstr: ValueError is raised when matplotlib version is incorrect and legend=True
docstr_tok: ["ValueError","is","raised","when","matplotlib","version","is","incorrect","and","legend=True"]
code: def test_legend_matplotlib_version(self, mock_toolkit):
      """
      ValueError is raised when matplotlib version is incorrect and legend=True
      """
      with pytest.raises(ImportError):
          from mpl_toolkits.axes_grid1 import inset_locator
  
          assert not inset_locator
  
      with pytest.raises(
          YellowbrickValueError, match="requires matplotlib 2.0.2"
      ):
          InterclusterDistance(KMeans(), legend=True)
  
imports: import pytest
  import matplotlib
  import numpy
  from yellowbrick.cluster.icdm import *
  from yellowbrick.datasets import load_nfl
  from yellowbrick.exceptions import YellowbrickValueError
  from unittest import mock
  from tests.fixtures import Dataset
  from tests.base import IS_WINDOWS_OR_CONDA, VisualTestCase
  from sklearn.datasets import make_blobs
  from sklearn.cluster import Birch, AgglomerativeClustering
  from sklearn.decomposition import LatentDirichletAllocation
  from sklearn.cluster import KMeans, AffinityPropagation, MiniBatchKMeans
  from sklearn.pipeline import Pipeline
  from sklearn.impute import SimpleImputer
label_desc: Use image node_id 9 for calling the TestInterclusterDistance obj's underlying member method code with example usage: obj.test_legend_matplotlib_version(mock_toolkit) without return types