code: def test_sample_weight(input_values):
      y_true = input_values["y_true"]
      y_pred = input_values["y_pred"]
      sample_weight = input_values["sample_weight"]
      expected_precision = input_values[
          "expected_precision_with_weight"
      ]
  
      # Tests list input.
      precision = precision_score(
          y_true=y_true, y_pred=y_pred, sample_weight=sample_weight
      )
      assert precision == expected_precision
  
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 9 for calling a global function with example usage: test_sample_weight(input_values) without return types