code: def test_add_tfds_id(dummy_dataset: dataset_builder.DatasetBuilder):
      """Tests `add_tfds_id=True`."""
      read_config = read_config_lib.ReadConfig(add_tfds_id=True)
      ds = dummy_dataset.as_dataset(
          split="train", read_config=read_config
      )
      assert ds.element_spec == {
          "id": tf.TensorSpec(shape=(), dtype=tf.int64),
          "tfds_id": tf.TensorSpec(shape=(), dtype=tf.string),
      }
      assert list(dataset_utils.as_numpy(ds)) == [
          {
              "id": 0,
              "tfds_id": b"dummy_dataset-train.tfrecord-00000-of-00001__0",
          },
          {
              "id": 1,
              "tfds_id": b"dummy_dataset-train.tfrecord-00000-of-00001__1",
          },
          {
              "id": 2,
              "tfds_id": b"dummy_dataset-train.tfrecord-00000-of-00001__2",
          },
      ]
  
      # Subsplit API works too
      ds = dummy_dataset.as_dataset(
          split="train[1:]", read_config=read_config
      )
      assert ds.element_spec == {
          "id": tf.TensorSpec(shape=(), dtype=tf.int64),
          "tfds_id": tf.TensorSpec(shape=(), dtype=tf.string),
      }
      assert list(dataset_utils.as_numpy(ds)) == [
          {
              "id": 1,
              "tfds_id": b"dummy_dataset-train.tfrecord-00000-of-00001__1",
          },
          {
              "id": 2,
              "tfds_id": b"dummy_dataset-train.tfrecord-00000-of-00001__2",
          },
      ]
  
file_path: datasets/tensorflow_datasets/core/dataset_builder_read_test.py
imports: from unittest import mock
  import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_utils
  from tensorflow_datasets.core import logging
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import read_config
label_desc: Use image node_id 1 for calling a global function with example usage: test_add_tfds_id(dummy_dataset) without return types