code: def test_cumulative_gain_curve():
      df = pd.DataFrame(
          dict(
              t=[1, 1, 1, 2, 2, 2, 3, 3, 3],
              x=[1, 2, 3, 1, 2, 3, 1, 2, 3],
              y=[1, 1, 1, 2, 3, 4, 3, 5, 7],
          )
      )
  
      expected = np.array(
          [
              1.0,
              1.33333333,
              1.62698413,
              1.66666667,
              1.94444444,
              2.18803419,
              2.0,
          ]
      )
  
      result = cumulative_gain_curve(
          df,
          prediction="x",
          outcome="y",
          treatment="t",
          min_rows=3,
          steps=df.shape[0],
          effect_fn=linear_effect,
      )
  
      np.testing.assert_allclose(expected, result, rtol=1e-07)
  
file_path: fklearn/tests/causal/validation/test_curves.py
imports: import numpy
  import pandas
  from fklearn.causal.effects import linear_effect
  from fklearn.causal.validation.curves import effect_by_segment, cumulative_effect_curve, cumulative_gain_curve, relative_cumulative_gain_curve, effect_curves
label_desc: Use image node_id 3 for calling a global function with example usage: test_cumulative_gain_curve() without return types