class_docstr: Tests for FLEURS dataset with af_za.
class_docstr_tok: ["Tests","for","FLEURS","dataset","with","af_za","."]
code: def _download_and_prepare_as_dataset(self, builder):
      super()._download_and_prepare_as_dataset(builder)
      if (
          not tf.executing_eagerly()
      ):  # Only test the following in eager mode.
          return
  
      def get_sorted_data(builder, split):
          splits = builder.as_dataset()
          data = list(tfds.as_numpy(splits[split]))
          return sorted(data, key=lambda x: x["path"])
  
      # Get the first example per split, sorting by path for consistency.
      train_ex = get_sorted_data(builder, tfds.Split.TRAIN)[0]
      dev_ex = get_sorted_data(builder, tfds.Split.VALIDATION)[0]
      test_ex = get_sorted_data(builder, tfds.Split.TEST)[0]
      # Check Train
      self.assertEqual(1348, train_ex["id"])
      self.assertIn(
          b"dummy_data/fleurs/af_za/audio/train/train_1.wav",
          train_ex["path"],
      )
      self.assertEqual(
          "Boot ritte.".encode(), train_ex["raw_transcription"]
      )
      self.assertEqual("boot ritte".encode(), train_ex["transcription"])
      self.assertEqual(32000, train_ex["num_samples"])
      self.assertEqual(1, train_ex["gender"])
      self.assertEqual(0, train_ex["lang_id"])
      self.assertEqual("Afrikaans".encode(), train_ex["language"])
      self.assertEqual(3, train_ex["lang_group_id"])
      self.assertEqual((32000,), train_ex["audio"].shape)
      self.assertCountEqual(
          [
              "id",
              "path",
              "audio",
              "raw_transcription",
              "transcription",
              "num_samples",
              "gender",
              "lang_id",
              "language",
              "lang_group_id",
          ],
          train_ex.keys(),
      )
      # Check Dev
      self.assertEqual(305, dev_ex["id"])
      self.assertIn(
          b"dummy_data/fleurs/af_za/audio/dev/dev_1.wav", dev_ex["path"]
      )
      self.assertEqual(
          "In die 1960s".encode(), dev_ex["raw_transcription"]
      )
      self.assertEqual("in die 1960s".encode(), dev_ex["transcription"])
      self.assertEqual(32000, dev_ex["num_samples"])
      self.assertEqual(0, dev_ex["gender"])
      self.assertEqual(0, dev_ex["lang_id"])
      self.assertEqual("Afrikaans".encode(), dev_ex["language"])
      self.assertEqual(3, dev_ex["lang_group_id"])
      self.assertEqual((32000,), dev_ex["audio"].shape)
      self.assertCountEqual(
          [
              "id",
              "path",
              "audio",
              "raw_transcription",
              "transcription",
              "num_samples",
              "gender",
              "lang_id",
              "language",
              "lang_group_id",
          ],
          dev_ex.keys(),
      )
      # Check Test
      self.assertEqual(5, test_ex["id"])
      self.assertIn(
          b"dummy_data/fleurs/af_za/audio/test/test_1.wav",
          test_ex["path"],
      )
      self.assertEqual("Boot.".encode(), test_ex["raw_transcription"])
      self.assertEqual("boot".encode(), test_ex["transcription"])
      self.assertEqual(32000, test_ex["num_samples"])
      self.assertEqual(1, test_ex["gender"])
      self.assertEqual(0, test_ex["lang_id"])
      self.assertEqual("Afrikaans".encode(), dev_ex["language"])
      self.assertEqual(3, test_ex["lang_group_id"])
      self.assertEqual((32000,), test_ex["audio"].shape)
      self.assertCountEqual(
          [
              "id",
              "path",
              "audio",
              "raw_transcription",
              "transcription",
              "num_samples",
              "gender",
              "lang_id",
              "language",
              "lang_group_id",
          ],
          test_ex.keys(),
      )
  
imports: import tensorflow
  from tensorflow_datasets.audio.xtreme_s import xtreme_s
  import tensorflow_datasets.public_api
label_desc: Use image node_id 1 for calling the FleursTest obj's underlying member method code with example usage: obj._download_and_prepare_as_dataset(builder) and returns: sorted