code: def test_builder_from_directories_reading(
      code_builder: dataset_builder.DatasetBuilder,
  ):
      other_dir1 = f"{code_builder.data_dir}/other1"
      other_dir2 = f"{code_builder.data_dir}/other2"
  
      # Copy from code_builder dir to the new dirs.
      tf.io.gfile.makedirs(other_dir1)
      tf.io.gfile.makedirs(other_dir2)
      for filename in tf.io.gfile.listdir(code_builder.data_dir):
          filepath = f"{code_builder.data_dir}/{filename}"
          if not tf.io.gfile.isdir(filepath):
              tf.io.gfile.copy(
                  src=filepath,
                  dst=f"{other_dir1}/{filename}",
                  overwrite=True,
              )
              tf.io.gfile.copy(
                  src=filepath,
                  dst=f"{other_dir2}/{filename}",
                  overwrite=True,
              )
  
      builder = read_only_builder.builder_from_directories(
          [other_dir1, other_dir2, code_builder.data_dir]
      )
      train_np = dataset_utils.as_numpy(
          builder.as_dataset(split="train")
      )
      assert len(train_np) == 9
      ds = dataset_utils.as_numpy(
          builder.as_dataset(split="train").take(5)
      )
      assert len(ds) == 5
  
      # Test split 'all'
      train_np = dataset_utils.as_numpy(builder.as_dataset(split="all"))
      assert len(train_np) == 9
      ds = dataset_utils.as_numpy(
          builder.as_dataset(split="all").take(5)
      )
      assert len(ds) == 5
  
imports: import contextlib
  import functools
  import os
  import pathlib
  import re
  from typing import Sequence
  from unittest import mock
  import dill
  from etils import epath
  import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_utils
  from tensorflow_datasets.core import load
  from tensorflow_datasets.core import proto
  from tensorflow_datasets.core import read_only_builder
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import features_dict
  from tensorflow_datasets.core.proto import dataset_info_pb2
  from tensorflow_datasets.core.utils import error_utils
  from tensorflow_datasets.core.utils import file_utils
  from google.protobuf import json_format
label_desc: Use image node_id 25 for calling a global function with example usage: test_builder_from_directories_reading(code_builder) without return types