code: def test_extract_snippets(self):
      doc = {
          "url": b"test/url.com",
          "text": b"the patient is in the emergency room. the doctor just left.",
      }
      abbreviations_by_expansion = {
          "patient": ["pt"],
          "emergency room": ["er"],
          "doctor": ["dr"],
      }
      expansion_re = re.compile("(patient|emergency room|doctor)")
      with mock.patch.object(
          np.random, "uniform", autospec=True
      ) as random_uniform_mock:
          random_uniform_mock.return_value = 0.1
          results = list(
              c4_wsrs_utils.extract_snippets(
                  doc,
                  max_sentences_per_snippet=1,
                  abbreviations_by_expansion=abbreviations_by_expansion,
                  expansion_regex=expansion_re,
                  max_snippet_char_len=1024,
                  alpha_keep_no_rs=0.0,
                  alpha_keep_rs=0.0,
              )
          )
      self.assertEqual(
          results,
          [
              (
                  "url=test/url.com,snippet_id=0",
                  (
                      "the patient is in the emergency room.",
                      ("pt", "patient"),
                      {
                          4: ("pt", "patient"),
                          22: ("er", "emergency room"),
                      },
                  ),
              ),
              (
                  "url=test/url.com,snippet_id=1",
                  (
                      "the doctor just left.",
                      ("dr", "doctor"),
                      {4: ("dr", "doctor")},
                  ),
              ),
          ],
      )
  
file_path: datasets/tensorflow_datasets/text/c4_wsrs/c4_wsrs_utils_test.py
imports: import re
  from unittest import mock
  from absl.testing import absltest
  import numpy
  from tensorflow_datasets.text.c4_wsrs import c4_wsrs_utils
label_desc: Use image node_id 3 for calling the C4WsrsUtilsTest obj's underlying member method code with example usage: obj.test_extract_snippets() without return types