code: def test_get_cardinality_factor():
      """Tests for get_cardinality_factor function"""
  
      cardinality_factor = get_cardinality_factor(overlap_count=[1])
      assert cardinality_factor == 1.0
  
      # When cardinality bias is set to "reciprocal", return the reciprocal of x where x is the number of
      # overlapping anomaly ranges with a certain anomaly range.
      # An example of this is when there is a real anomaly range, with two predicted anomaly ranges overlapping
      # with it. In this case, the cardinality factor should be 1/2
      cardinality_factor = get_cardinality_factor(
          overlap_count=[2], cardinality_bias="reciprocal"
      )
      assert cardinality_factor == 0.5
  
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 2 for calling a global function with example usage: test_get_cardinality_factor() without return types