code: def test_range_based_precision_score(range_based_input_values):
      """Tests for range_based_precision_score function"""
  
      y_true = range_based_input_values["y_true"]
      y_pred = range_based_input_values["y_pred"]
  
      # Tests range-based precision with flat positional bias
      expected_precision = range_based_input_values[
          "expected_range_based_precision_flat_positional_bias"
      ]
      range_based_precision = range_based_precision_score(
          y_true=y_true, y_pred=y_pred, positional_bias="flat"
      )
      assert round(range_based_precision, 3) == expected_precision
  
      # Tests range-based precision with front positional bias
      expected_precision = range_based_input_values[
          "expected_range_based_precision_front_positional_bias"
      ]
      range_based_precision = range_based_precision_score(
          y_true=y_true, y_pred=y_pred, positional_bias="front"
      )
      assert round(range_based_precision, 3) == expected_precision
  
      # Tests range-based precision with middle positional bias
      expected_precision = range_based_input_values[
          "expected_range_based_precision_middle_positional_bias"
      ]
      range_based_precision = range_based_precision_score(
          y_true=y_true, y_pred=y_pred, positional_bias="middle"
      )
      assert round(range_based_precision, 3) == expected_precision
  
      # Tests range-based precision with back positional bias
      expected_precision = range_based_input_values[
          "expected_range_based_precision_back_positional_bias"
      ]
      range_based_precision = range_based_precision_score(
          y_true=y_true, y_pred=y_pred, positional_bias="back"
      )
      assert round(range_based_precision, 3) == expected_precision
  
      # Tests if the range_based implementation subsumes the classical recall implementation
      classical_precision = precision_score(
          y_true=pd.Series(y_true), y_pred=pd.Series(y_pred)
      )
      precision = range_based_precision_score(
          y_true=y_true, y_pred=y_pred, range_based=False
      )
      assert round(precision, 3) == round(classical_precision[1], 3)
  
imports: import numpy
  import pandas
  import pytest
  from greykite.detection.common.ad_evaluation import confusion_matrix
  from greykite.detection.common.ad_evaluation import f1_score
  from greykite.detection.common.ad_evaluation import informedness_statistic
  from greykite.detection.common.ad_evaluation import matthews_corrcoef
  from greykite.detection.common.ad_evaluation import precision_score
  from greykite.detection.common.ad_evaluation import range_based_precision_score
  from greykite.detection.common.ad_evaluation import range_based_recall_score
  from greykite.detection.common.ad_evaluation import recall_score
  from greykite.detection.common.ad_evaluation import soft_f1_score
  from greykite.detection.common.ad_evaluation import soft_precision_score
  from greykite.detection.common.ad_evaluation import soft_recall_score
label_desc: Use image node_id 13 for calling a global function with example usage: test_range_based_precision_score(range_based_input_values) without return types