code: def test_one_category():
      train = cudf.DataFrame(
          {"category": ["a", "a", "a", "a"], "label": [3, 0, 0, 3]}
      )
      test = cudf.DataFrame({"category": ["c", "b", "a", "d"]})
  
      encoder = TargetEncoder()
      train_encoded = encoder.fit_transform(train.category, train.label)
      answer = np.array([1.0, 2.0, 2.0, 1.0])
      assert array_equal(train_encoded, answer)
  
      test_encoded = encoder.transform(test.category)
      answer = np.array([1.5, 1.5, 1.5, 1.5])
      assert array_equal(test_encoded, answer)
  
file_path: cuml/python/cuml/tests/test_target_encoder.py
imports: import pytest
  from cuml.testing.utils import array_equal
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.preprocessing.TargetEncoder import TargetEncoder
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 6 for calling a global function with example usage: test_one_category() without return types