code: def test_suite_stackedensemble_training_frame(blending=False):
      def test_base_models_can_use_different_x():
          """
          test that passing in base models that use different subsets of
          the features works. (different x, but same training_frame)
          """
          ds = prepare_data(blending)
          datasets = pu.ns(
              gbm=ds.extend(x=ds.x[1:11]), drf=ds.extend(x=ds.x[13:20])
          )
  
          bm = train_base_models(datasets)
          se = train_stacked_ensemble(ds, bm)
          se_nox = train_stacked_ensemble(ds.extend(x=None), bm)
          assert se.auc() > 0
          assert se.auc() == se_nox.auc()
  
      def test_base_models_can_use_different_compatible_training_frames():
          """
          test that passing in base models that use different subsets of
          the features works. (different training_frame)
          """
          ds = prepare_data(blending)
          datasets = pu.ns(
              gbm=ds.extend(
                  x=None,
                  train=ds.train[list(range(1, 11))].cbind(
                      ds.train[ds.y]
                  ),
              ),
              drf=ds.extend(
                  x=None,
                  train=ds.train[list(range(13, 20))].cbind(
                      ds.train[ds.y]
                  ),
              ),
          )
          bm = train_base_models(datasets)
          se = train_stacked_ensemble(ds, bm)
          assert se.auc() > 0
  
      def test_se_fails_when_base_models_use_incompatible_training_frames():
          """
          test that SE fails when passing in base models that were trained with frames of different size
          """
          ds = prepare_data(blending)
          datasets = pu.ns(
              gbm=ds.extend(x=None),
              drf=ds.extend(
                  x=None, train=ds.train[0 : ds.train.nrows // 2, :]
              ),
          )
          bm = train_base_models(datasets)
          try:
              se = train_stacked_ensemble(ds, bm)
              assert (
                  blending
              ), "Stacked Ensembles of models with different training frame sizes should fail in non-blending mode"
              se.predict(ds.train)
          except Exception as e:
              assert (
                  not blending
              ), "No Exception should have been raised in blending mode"
              assert (
                  "Base models are inconsistent: they use different size (number of rows) training frames"
                  in str(e)
              ), "wrong error message: {}".format(str(e))
              # raise e
  
      return [
          pu.tag_test(test, "blending" if blending else None)
          for test in [
              test_base_models_can_use_different_x,
              test_base_models_can_use_different_compatible_training_frames,
              test_se_fails_when_base_models_use_incompatible_training_frames,
          ]
      ]
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_base_model_training_frame.py
imports: import h2o
  import sys
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_suite_stackedensemble_training_frame(blending) and returns: unknown