code: def test_get_positional_reward():
      """Tests for get_positional_reward function"""
  
      # With "flat" positional bias, no matter where a pointwise anomaly is within an anomaly
      # range of length 5, return a fixed value (1.0)
      positional_reward = get_positional_reward(
          loc=1, anomaly_length=5, positional_bias="flat"
      )
      assert positional_reward == 1.0
      positional_reward = get_positional_reward(
          loc=3, anomaly_length=5, positional_bias="flat"
      )
      assert positional_reward == 1.0
      positional_reward = get_positional_reward(
          loc=5, anomaly_length=5, positional_bias="flat"
      )
      assert positional_reward == 1.0
  
      # With "front" positional bias, higher positional reward is allocated to a pointwise
      # anomaly the earlier it is in the anomaly range of length 5
      positional_reward = get_positional_reward(
          loc=1, anomaly_length=5, positional_bias="front"
      )
      assert positional_reward == 5.0
      positional_reward = get_positional_reward(
          loc=5, anomaly_length=5, positional_bias="front"
      )
      assert positional_reward == 1.0
  
      # With "middle" positional bias, higher positional reward is allocated to a pointwise anomaly
      # the closer to the middle it is of the anomaly range of length 5
      positional_reward = get_positional_reward(
          loc=1, anomaly_length=5, positional_bias="middle"
      )
      assert positional_reward == 1.0
      positional_reward = get_positional_reward(
          loc=3, anomaly_length=5, positional_bias="middle"
      )
      assert positional_reward == 3.0
      positional_reward = get_positional_reward(
          loc=5, anomaly_length=5, positional_bias="middle"
      )
      assert positional_reward == 1.0
  
      # With "back" positional bias, higher positional reward is allocated to a pointwise anomaly
      # the later it is in the anomaly range of length 5
      positional_reward = get_positional_reward(
          loc=1, anomaly_length=5, positional_bias="back"
      )
      assert positional_reward == 1.0
      positional_reward = get_positional_reward(
          loc=5, anomaly_length=5, positional_bias="back"
      )
      assert positional_reward == 5.0
  
file_path: greykite/greykite/tests/detection/common/test_ad_evaluation_utils.py
imports: import numpy
  from greykite.detection.common.ad_evaluation_utils import compute_range_based_score
  from greykite.detection.common.ad_evaluation_utils import get_cardinality_factor
  from greykite.detection.common.ad_evaluation_utils import get_overlap_size_and_position_reward
  from greykite.detection.common.ad_evaluation_utils import get_positional_reward
  from greykite.detection.common.ad_evaluation_utils import prepare_anomaly_ranges
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_positional_reward() without return types