code: def test_transform_can_be_applied_to_training_frame_with_special_flag():
      ds = load_dataset()
      te = H2OTargetEncoderEstimator()
      te.train(y=ds.target, training_frame=ds.train)
      transformed_as_training = te.transform(ds.train, as_training=True)
      transformed = te.transform(ds.train)
  
      assert pu.compare_frames(
          transformed, transformed_as_training, 0, tol_numeric=1e-5
      )
  
      # now with non default params
      te_nd = H2OTargetEncoderEstimator(
          data_leakage_handling="leave_one_out",
          blending=True,
          inflection_point=5,
          smoothing=17,
          seed=seed,
          noise=0.01,
      )
      te_nd.train(y=ds.target, training_frame=ds.train)
      transformed_as_training = te_nd.transform(
          ds.train, as_training=True
      )
      transformed = te_nd.transform(ds.train)
      try:
          assert pu.compare_frames(
              transformed, transformed_as_training, 0, tol_numeric=1e-5
          )
          assert False, "should have raised"
      except AssertionError as ae:
          assert "should have raised" not in str(ae)
  
file_path: h2o-3/h2o-py/tests/testdir_algos/targetencoder/pyunit_targetencoder_transform.py
imports: import os
  import sys
  import h2o
  from h2o.estimators import H2OTargetEncoderEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 3 for calling a global function with example usage: test_transform_can_be_applied_to_training_frame_with_special_flag() without return types