code: def test_transform_data_leakage_handling_param_raise_warning():
      ds = load_dataset(incl_test=True)
      te = H2OTargetEncoderEstimator(
          data_leakage_handling="leave_one_out", seed=42
      )
      te.train(y=ds.target, training_frame=ds.train)
      encoded = te.predict(ds.test)
      encoded_as_training = te.transform(ds.test, as_training=True)
  
      transformed_1 = te.transform(ds.test)
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          transformed_2 = te.transform(
              ds.test, data_leakage_handling="none"
          )
          assert len(w) == 1
          assert issubclass(w[0].category, H2ODeprecationWarning)
          assert (
              "`data_leakage_handling` is deprecated in `transform` method and will be ignored"
              in str(w[0].message)
          )
  
      # if data_leakage_handling is specified and not "none", this is interpreted as `as_training=True`
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          transformed_3 = te.transform(
              ds.test, data_leakage_handling="leave_one_out"
          )
          assert len(w) == 2
          assert issubclass(w[1].category, H2ODeprecationWarning)
          assert "as_training=True" in str(w[1].message)
  
      assert pu.compare_frames(
          encoded, transformed_1, 0, tol_numeric=1e-5
      )
      assert pu.compare_frames(
          encoded, transformed_2, 0, tol_numeric=1e-5
      )
      assert pu.compare_frames(
          encoded_as_training, transformed_3, 0, tol_numeric=1e-5
      )
      try:
          pu.compare_frames(encoded, transformed_3, 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_te_deprecated_params.py
imports: import os
  import sys
  import warnings
  import h2o
  from h2o.estimators import H2OTargetEncoderEstimator
  from h2o.exceptions import H2ODeprecationWarning
  from h2o.utils.metaclass import fullname
  from tests import pyunit_utils
label_desc: Use image node_id 6 for calling a global function with example usage: test_transform_data_leakage_handling_param_raise_warning() without return types