code: def test_segment_precision_recall(test_case: Dict):
      (
          obtained_segment_precision,
          obtained_segment_recall,
      ) = segment_precision_recall(
          test_case["real_ranges"], test_case["pred_ranges"]
      )
  
      expected_segment_precision = test_case["segment_precision"]
      np.testing.assert_almost_equal(
          obtained_segment_precision, expected_segment_precision
      ), f"Expected segment precision: {expected_segment_precision}, " f"obtained segment precision: {obtained_segment_precision}"
  
      expected_segment_recall = test_case["segment_recall"]
      np.testing.assert_almost_equal(
          obtained_segment_recall, expected_segment_recall
      ), f"Expected segment recall: {expected_segment_recall}, " f"obtained segment recall: {obtained_segment_recall}"
  
file_path: gluonts/test/nursery/anomaly_detection/supervised_metrics/test_precision_recall.py
imports: from typing import Dict, List, Tuple
  import numpy
  import pytest
  from sklearn.metrics import auc
  from gluonts.nursery.anomaly_detection.supervised_metrics import aggregate_precision_recall_curve, buffered_precision_recall, segment_precision_recall
  from gluonts.nursery.anomaly_detection.supervised_metrics._buffered_precision_recall import extend_ranges
  from gluonts.nursery.anomaly_detection.supervised_metrics.bounded_pr_auc import bounded_pr_auc
  from gluonts.nursery.anomaly_detection.supervised_metrics.utils import labels_to_ranges, range_overlap
label_desc: Use image node_id 1 for calling a global function with example usage: test_segment_precision_recall(test_case) without return types