code: def test_ensemble_heterogeneous_estimators_name_validation(
      X, y, Ensemble
  ):
      # raise an error when the name contains dunder
      if issubclass(Ensemble, ClassifierMixin):
          estimators = [("lr__", LogisticRegression())]
      else:
          estimators = [("lr__", LinearRegression())]
      ensemble = Ensemble(estimators=estimators)
  
      err_msg = r"Estimator names must not contain __: got \['lr__'\]"
      with pytest.raises(ValueError, match=err_msg):
          ensemble.fit(X, y)
  
      # raise an error when the name is not unique
      if issubclass(Ensemble, ClassifierMixin):
          estimators = [
              ("lr", LogisticRegression()),
              ("lr", LogisticRegression()),
          ]
      else:
          estimators = [
              ("lr", LinearRegression()),
              ("lr", LinearRegression()),
          ]
      ensemble = Ensemble(estimators=estimators)
  
      err_msg = r"Names provided are not unique: \['lr', 'lr'\]"
      with pytest.raises(ValueError, match=err_msg):
          ensemble.fit(X, y)
  
      # raise an error when the name conflicts with the parameters
      if issubclass(Ensemble, ClassifierMixin):
          estimators = [("estimators", LogisticRegression())]
      else:
          estimators = [("estimators", LinearRegression())]
      ensemble = Ensemble(estimators=estimators)
  
      err_msg = "Estimator names conflict with constructor arguments"
      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 3 for calling a global function with example usage: test_ensemble_heterogeneous_estimators_name_validation(X, y, Ensemble) without return types