code: def test_input_shap_values_type_2():
      """Check that a DimensionError is raised if the cohort Explanation objects have different shape."""
      rs = np.random.RandomState(42)
      emsg = (
          "When passing several Explanation objects, they must all have "
          "the same number of feature columns!"
      )
      with pytest.raises(DimensionError, match=emsg):
          shap.plots.bar(
              {
                  "t1": shap.Explanation(
                      values=rs.randn(40, 10),
                      base_values=np.ones(40) * 0.5,
                  ),
                  "t2": shap.Explanation(
                      values=rs.randn(20, 5),
                      base_values=np.ones(20) * 0.5,
                  ),
              },
              show=False,
          )
  
file_path: shap/tests/plots/test_bar.py
imports: import matplotlib.pyplot
  import numpy
  import pytest
  import shap
  from shap.utils._exceptions import DimensionError
label_desc: Use image node_id 2 for calling a global function with example usage: test_input_shap_values_type_2() without return types