code: def test_calculate_tradeoff_points():
      data = pd.DataFrame(
          {
              SENSITIVE_FEATURE_KEY: sensitive_features_ex1.squeeze(),
              SCORE_KEY: scores_ex.squeeze(),
              LABEL_KEY: labels_ex.squeeze(),
          }
      )
      grouped_data = (
          data.groupby(SENSITIVE_FEATURE_KEY)
          .get_group("A")
          .sort_values(by=SCORE_KEY, ascending=False)
      )
  
      roc_points = _calculate_tradeoff_points(
          grouped_data, "A", flip=True
      )
      expected_roc_points = pd.DataFrame(
          {
              "x": [0, 0.0, 0.25, 0.5, 0.5, 0.5, 0.5, 0.75, 1.0, 1],
              "y": [
                  0,
                  0.0,
                  1 / 3,
                  0.0,
                  0.1 / 0.3,
                  2 / 3,
                  1,
                  0.2 / 0.3,
                  1.0,
                  1,
              ],
              "operation": [
                  ThresholdOperation(">", np.inf),
                  ThresholdOperation("<", -np.inf),
                  ThresholdOperation("<", 0.5),
                  ThresholdOperation(">", 2.5),
                  ThresholdOperation(">", 1.5),
                  ThresholdOperation("<", 1.5),
                  ThresholdOperation("<", 2.5),
                  ThresholdOperation(">", 0.5),
                  ThresholdOperation("<", np.inf),
                  ThresholdOperation(">", -np.inf),
              ],
          }
      )
  
      _assert_equal_points(expected_roc_points, roc_points)
  
      expected_roc_convex_hull = pd.DataFrame(
          {
              "x": [0, 0.5, 1],
              "y": [0, 1, 1],
              "operation": [
                  ThresholdOperation(">", np.inf),
                  ThresholdOperation("<", 2.5),
                  ThresholdOperation(">", -np.inf),
              ],
          }
      )
      # Try filtering to get the convex hull of the ROC points.
      selected_points = pd.DataFrame(
          _filter_points_to_get_convex_hull(roc_points)
      )[["x", "y", "operation"]]
      _assert_equal_points(expected_roc_convex_hull, selected_points)
  
file_path: fairlearn/test/unit/postprocessing/test_curve_utilities.py
imports: import numpy
  import pandas
  import pytest
  from fairlearn.postprocessing._constants import LABEL_KEY, SCORE_KEY, SENSITIVE_FEATURE_KEY
  from fairlearn.postprocessing._threshold_operation import ThresholdOperation
  from fairlearn.postprocessing._tradeoff_curve_utilities import _calculate_tradeoff_points, _filter_points_to_get_convex_hull, _interpolate_curve, _tradeoff_curve
  from .conftest import _get_grouped_data_and_base_points, labels_ex, scores_ex, sensitive_feature_names_ex1, sensitive_features_ex1
label_desc: Use image node_id 4 for calling a global function with example usage: test_calculate_tradeoff_points() without return types