code: def test_predict_cumulative_hazard_function_range(
      estimator_cls, toy_data_exponential
  ):
      x, y = toy_data_exponential
  
      estimator = estimator_cls()
      if "fit_baseline_model" in estimator.get_params():
          estimator.set_params(fit_baseline_model=True)
      estimator.fit(x, y)
  
      t_min = y["time"].min()
      t_max = y["time"].max()
      t_mid = (t_max - t_min) / 2.0
  
      for fn in estimator.predict_cumulative_hazard_function(x):
          v = fn(t_min)
          assert np.isfinite(v)
          assert v == 0
  
      for fn in estimator.predict_cumulative_hazard_function(x):
          v = fn(t_mid)
          assert np.isfinite(v)
          assert v >= 0
  
      t_smaller_min = t_min / 2
      for fn in estimator.predict_cumulative_hazard_function(x):
          v = fn(t_smaller_min)
          assert np.isfinite(v)
          assert v == 0
  
      for fn in estimator.predict_cumulative_hazard_function(x):
          v = fn(t_max)
          assert np.isfinite(v)
          assert v >= 0
  
      t_bigger_max = t_max + 1
      for fn in estimator.predict_cumulative_hazard_function(x):
          with pytest.raises(
              ValueError, match=r"x must be within \[[0-9.]+; [0-9.]+\]"
          ):
              fn(t_bigger_max)
  
file_path: scikit-survival/tests/test_functions.py
imports: import numpy
  from numpy.testing import assert_array_equal
  import pytest
  from sksurv.functions import StepFunction
  from sksurv.testing import all_survival_estimators
label_desc: Use image node_id 3 for calling a global function with example usage: test_predict_cumulative_hazard_function_range(estimator_cls, toy_data_exponential) without return types