code: def assert_survival_function_properties(surv_fns):
      if not np.isfinite(surv_fns).all():
          raise AssertionError(
              "survival function contains values that are not finite"
          )
      if np.any(surv_fns < 0.0):
          raise AssertionError(
              "survival function contains negative values"
          )
      if np.any(surv_fns > 1.0):
          raise AssertionError(
              "survival function contains values larger 1"
          )
  
      d = np.apply_along_axis(np.diff, 1, surv_fns)
      if np.any(d > 0):
          raise AssertionError(
              "survival functions are not monotonically decreasing"
          )
  
      # survival function at first time point
      num_closer_to_zero = np.sum(
          1.0 - surv_fns[:, 0] >= surv_fns[:, 0]
      )
      if num_closer_to_zero / surv_fns.shape[0] > 0.5:
          raise AssertionError(
              f"most ({num_closer_to_zero}) probabilities at first time point are closer to 0 than 1"
          )
  
      # survival function at last time point
      num_closer_to_one = np.sum(
          1.0 - surv_fns[:, -1] < surv_fns[:, -1]
      )
      if num_closer_to_one / surv_fns.shape[0] > 0.5:
          raise AssertionError(
              f"most ({num_closer_to_one}) probabilities at last time point are closer to 1 than 0"
          )
  
file_path: scikit-survival/sksurv/testing.py
imports: from importlib import import_module
  import inspect
  from pathlib import Path
  import pkgutil
  import numpy
  from numpy.testing import assert_almost_equal, assert_array_equal
  import pytest
  import sksurv
  from sksurv.base import SurvivalAnalysisMixin
  from sksurv.metrics import concordance_index_censored
label_desc: Use image node_id 2 for calling a global function with example usage: assert_survival_function_properties(surv_fns) without return types