code: def test_ensemble_heterogeneous_estimators_type(Ensemble):
      # check that ensemble will fail during validation if the underlying
      # estimators are not of the same type (i.e. classifier or regressor)
      # StackingClassifier can have an underlying regresor so it's not checked
      if issubclass(Ensemble, ClassifierMixin):
          X, y = make_classification(n_samples=10)
          estimators = [("lr", LinearRegression())]
          ensemble_type = "classifier"
      else:
          X, y = make_regression(n_samples=10)
          estimators = [("lr", LogisticRegression())]
          ensemble_type = "regressor"
      ensemble = Ensemble(estimators=estimators)
  
      err_msg = "should be a {}".format(ensemble_type)
      with pytest.raises(ValueError, match=err_msg):
          ensemble.fit(X, y)
  
file_path: scikit-learn/sklearn/ensemble/tests/test_common.py
imports: import numpy
  import pytest
  from sklearn.base import ClassifierMixin, clone, is_classifier
  from sklearn.datasets import load_diabetes, load_iris, make_classification, make_regression
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor, StackingClassifier, StackingRegressor, VotingClassifier, VotingRegressor
  from sklearn.impute import SimpleImputer
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from sklearn.pipeline import make_pipeline
  from sklearn.svm import SVC, SVR, LinearSVC, LinearSVR
label_desc: Use image node_id 2 for calling a global function with example usage: test_ensemble_heterogeneous_estimators_type(Ensemble) without return types