code: def test_metamorphic(self):
      # When we only slightly alter the input data or an irrelevant argument, the output should remain unchanged.
      x1 = ["A", "B", "B"]  # Baseline
      x2 = [
          "Apple",
          "Banana",
          "Banana",
      ]  # Different strings, but with the same alphabetic ordering
      x3 = pd.DataFrame(data={"x": ["A", "B", "B"]})  # DataFrame
      x4 = pd.Series(
          ["A", "B", "B"], dtype="category"
      )  # Series with category data type
      x5 = np.array(["A", "B", "B"])  # Numpy
      x6 = [
          "Z",
          "Y",
          "Y",
      ]  # Different strings, reversed alphabetic ordering (it works because we look at the order of appearance, not at alphabetic order)
  
      y = [1, 1, 0]
  
      for encoder_name in set(encoders.__all__) - {
          "HashingEncoder"
      }:  # Hashing encoder is, by definition, not invariant to data changes
          with self.subTest(encoder_name=encoder_name):
              enc1 = getattr(encoders, encoder_name)()
              result1 = enc1.fit_transform(x1, y)
  
              enc2 = getattr(encoders, encoder_name)()
              result2 = enc2.fit_transform(x2, y)
              self.assertTrue(result1.equals(result2))
  
              enc3 = getattr(encoders, encoder_name)()
              result3 = enc3.fit_transform(x3, y)
              self.assertTrue(
                  (result1.to_numpy() == result3.to_numpy()).all()
              )
  
              enc4 = getattr(encoders, encoder_name)()
              result4 = enc4.fit_transform(x4, y)
              self.assertTrue(result1.equals(result4))
  
              enc5 = getattr(encoders, encoder_name)()
              result5 = enc5.fit_transform(x5, y)
              self.assertTrue(result1.equals(result5))
  
              # gray encoder actually does re-order inputs
              # rankhot encoder respects order, in this example the order is switched
              if encoder_name not in ["GrayEncoder", "RankHotEncoder"]:
                  enc6 = getattr(encoders, encoder_name)()
                  result6 = enc6.fit_transform(x6, y)
                  self.assertTrue(result1.equals(result6))
  
              # Arguments
              enc9 = getattr(encoders, encoder_name)(return_df=False)
              result9 = enc9.fit_transform(x1, y)
              self.assertTrue((result1.to_numpy() == result9).all())
  
              enc10 = getattr(encoders, encoder_name)(verbose=True)
              result10 = enc10.fit_transform(x1, y)
              self.assertTrue(result1.equals(result10))
  
              # Note: If the encoder does not support these arguments/argument values, it is OK/expected to fail.
              # Note: The indicator approach is not tested because it adds columns -> the encoders that support it are expected to fail.
  
              # enc11 = getattr(encoders, encoder_name)(handle_unknown='return_nan', handle_missing='return_nan')  # Quite a few algorithms fail here because of handle_missing
              # result11 = enc11.fit_transform(x1, y)
              # self.assertTrue((result1.values == result11.values).all(), 'The data do not contain any missing or new value -> the result should be unchanged.')
  
              enc12 = getattr(encoders, encoder_name)(
                  handle_unknown="value", handle_missing="value"
              )
              result12 = enc12.fit_transform(x1, y)
              self.assertTrue(
                  result1.equals(result12),
                  "The data do not contain any missing or new value -> the result should be unchanged.",
              )
  
imports: import warnings
  from datetime import timedelta
  import numpy
  from numpy.testing import assert_array_equal
  import pandas
  import sklearn
  import tests.helpers
  from sklearn.utils.estimator_checks import check_transformer_general, check_transformers_unfitted, check_n_features_in
  from sklearn.compose import ColumnTransformer
  from unittest import TestCase
  from copy import deepcopy
  import category_encoders
label_desc: Use image node_id 39 for calling the TestEncoders obj's underlying member method code with example usage: obj.test_metamorphic() without return types