code: def test_drop_duplicates_category_edge_cases():
      df = pd.DataFrame(
          {
              "A": [0, 1, 2, 3, 4],
              "B": [0, 3, "b", 4, np.nan],
              "C": ["a", "b", 3, "d", "e"],
              "D": [0, 3, "b", 4, np.nan],
              "E": [5, np.nan, "b", 4, 3],
              "F": [4, 3, 2, 1, 0],
              "G": [4, 3, 2, 1, 4],
          }
      )
      feature_generator = DropDuplicatesFeatureGenerator()
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop D because B and D are identical with same dtype, and B comes earlier
      expected_dropped_1 = ["D"]
      actual_dropped_1 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_1 == actual_dropped_1
  
      df2 = pd.DataFrame(
          {
              "A": [0, 1, 2, 3, 4],
              "D": [0, 3, "b", 4, np.nan],
              "C": ["a", "b", 3, "d", "e"],
              "B": [0, 3, "b", 4, np.nan],
              "E": [5, np.nan, "b", 4, 3],
              "F": [4, 3, 2, 1, 0],
              "G": [4, 3, 2, 1, 4],
          }
      )
      feature_metadata_in2 = FeatureMetadata.from_df(df2)
      # Drop B because B and D are identical with same dtype, and D comes earlier
      expected_dropped_2 = ["B"]
      actual_dropped_2 = feature_generator._drop_duplicate_features(
          X=df2, feature_metadata_in=feature_metadata_in2
      )
      assert expected_dropped_2 == actual_dropped_2
  
      df["D"] = df["D"].astype("category")
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop nothing because even though B and D have same values, they aren't the same dtype and thus aren't safe to drop.
      expected_dropped_3 = []
      actual_dropped_3 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_3 == actual_dropped_3
  
      df["B"] = df["B"].astype("category")
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop D because B and D are identical with same dtype, and B comes earlier
      expected_dropped_4 = ["D"]
      actual_dropped_4 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_4 == actual_dropped_4
  
      df["E"] = df["E"].astype("category")
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop D and E because B and D are identical with same dtype, and B comes earlier, and E is functionally identical and comes later
      expected_dropped_5 = ["D", "E"]
      actual_dropped_5 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_5 == actual_dropped_5
  
      # Make everything category type
      df["A"] = df["A"].astype("category")
      df["C"] = df["C"].astype("category")
      df["F"] = df["F"].astype("category")
      df["G"] = df["G"].astype("category")
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop all except A and G, because all others are equal to A functionally
      expected_dropped_6 = ["B", "C", "D", "E", "F"]
      actual_dropped_6 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_6 == actual_dropped_6
  
      # Make everything object type
      df = df.astype("object")
      feature_metadata_in = FeatureMetadata.from_df(df)
  
      # Drop only D, because B and D are identical with same dtype, and B is earlier
      expected_dropped_7 = ["D"]
      actual_dropped_7 = feature_generator._drop_duplicate_features(
          X=df, feature_metadata_in=feature_metadata_in
      )
      assert expected_dropped_7 == actual_dropped_7
  
file_path: autogluon/features/tests/features/generators/test_drop_duplicates.py
imports: import numpy
  import pandas
  from autogluon.common import FeatureMetadata
  from autogluon.features.generators import DropDuplicatesFeatureGenerator
label_desc: Use image node_id 4 for calling a global function with example usage: test_drop_duplicates_category_edge_cases() without return types