code: def test_as_data_source_fn():
      as_data_source_fn = lambda *args, **kwargs: ["foo", "bar", "baz"]
      with tfds.testing.mock_data(as_data_source_fn=as_data_source_fn):
          imagenet = tfds.data_source("imagenet2012", split="train")
          assert len(imagenet) == 3
          assert imagenet[0] == "foo"
          assert imagenet[1] == "bar"
          assert imagenet[2] == "baz"
  
imports: import functools
  import pickle
  import numpy
  import pytest
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 21 for calling a global function with example usage: test_as_data_source_fn() without return types