code: def test_compute_scenario_document_contamination():
      tokenizer = LightTokenizer()
      scenarios = [TEST_SCENARIO_1, TEST_SCENARIO_2]
      all_contamination_stats: AllContaminationStats
      ngram_index: NgramIndex
      all_contamination_stats = create_all_contamination_stats(
          light_scenarios=scenarios, n_values=N_VALUES
      )
      ngram_index = create_ngram_index(
          light_scenarios=scenarios,
          n_values=N_VALUES,
          tokenizer=tokenizer,
      )
  
      compute_scenario_document_contamination(
          document=TEST_DOCUMENT,
          ngram_index=ngram_index,
          all_contamination_stats=all_contamination_stats,
          tokenizer=tokenizer,
      )
  
      stats_1_key, stats_2_key, stats_3_key = (
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_1.light_scenario_key,
                  "N": 5,
              }
          ),
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_2.light_scenario_key,
                  "N": 5,
              }
          ),
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_2.light_scenario_key,
                  "N": 13,
              }
          ),
      )
      stats_1, stats_2, stats_3 = (
          all_contamination_stats[stats_1_key],
          all_contamination_stats[stats_2_key],
          all_contamination_stats[stats_3_key],
      )
  
      assert (
          stats_1._input_bits[0] == 1
          and stats_1.contaminated_input_fraction == 0.5
          and stats_1.contaminated_reference_fraction == 0
      )
      assert (
          stats_2.contaminated_input_fraction == 1
          and stats_2.contaminated_reference_fraction == 1
      )
      assert (
          stats_3.contaminated_input_fraction == 1
          and stats_3.contaminated_reference_fraction == 1
      )
  
      assert stats_1.generate_summary() == {
          "setting": {"stats_key": asdict_without_nones(stats_1_key)},
          "num_instances": 2,
          "num_instances_with_contaminated_input": 1,
          "num_instances_with_contaminated_reference": 0,
          "contaminated_input_fraction": 0.5,
          "contaminated_reference_fraction": 0,
      }
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/contamination/test_compute_contamination_metrics.py
imports: from typing import List
  from helm.benchmark.contamination.compute_contamination_metrics import compute_scenario_document_contamination, create_all_contamination_stats, create_ngram_index, EntryContaminationKey, Ngram, NgramIndex, AllContaminationStats
  from helm.benchmark.contamination.light_scenario import LightScenario, LightInstance, LightScenarioKey
  from helm.benchmark.contamination.light_tokenizer import LightTokenizer, DefaultTokenizer
  from helm.benchmark.contamination.contamination_stats import ContaminationStats, ContaminationStatsKey, PART_INPUT, PART_REF
  from helm.common.general import asdict_without_nones
label_desc: Use image node_id 4 for calling a global function with example usage: test_compute_scenario_document_contamination() without return types