code: def test_custom_as_dataset(mock_data):
      def _as_dataset(
          self, *args, **kwargs
      ):  # pylint: disable=unused-argument
          return tf.data.Dataset.from_generator(
              lambda: (  # pylint: disable=g-long-lambda
                  {"text": t}
                  for t in ["some sentence", "some other sentence"]
              ),
              output_types=self.info.features.dtype,
              output_shapes=self.info.features.shape,
          )
  
      with mock_data(as_dataset_fn=_as_dataset):
          ds = tfds.load("librispeech_lm", split="train")
          out = [ex["text"] for ex in tfds.as_numpy(ds)]
          assert out == [b"some sentence", b"some other sentence"]
  
imports: import functools
  import pickle
  import numpy
  import pytest
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 9 for calling a global function with example usage: test_custom_as_dataset(mock_data) and returns: tf