code: def test_builder_code_not_found(
      code_builder: dataset_builder.DatasetBuilder,
  ):
      """If the code isn't found, use files instead."""
  
      # Patch `tfds.builder_cls` to emulate that the dataset isn't registered
      with mock.patch.object(
          load,
          "builder_cls",
          side_effect=registered.DatasetNotFoundError(
              code_builder.name
          ),
      ):
          # Files exists, but not code, loading from files
          builder = load.builder(code_builder.name)
          assert isinstance(builder, read_only_builder.ReadOnlyBuilder)
          load.load(
              code_builder.name, split=[]
          )  # Dataset found -> no error
  
          if code_builder.builder_config:
              # When the code isn't found, default config is inferred from `.config/`
              assert (
                  builder.builder_config.name
                  == code_builder.default_builder_config.name
              )
  
              # Explicitly passing a config should works too.
              config_name = f"{code_builder.name}/{code_builder.builder_config.name}"
              builder = load.builder(config_name)
              assert isinstance(
                  builder, read_only_builder.ReadOnlyBuilder
              )
  
          # Neither code not files found, raise DatasetNotFoundError
          with pytest.raises(registered.DatasetNotFoundError):
              load.builder(
                  code_builder.name,
                  data_dir="/tmp/non-existing/tfds/dir",
              )
  
          with pytest.raises(registered.DatasetNotFoundError):
              load.load(
                  code_builder.name,
                  split=[],
                  data_dir="/tmp/non-existing/tfds/dir",
              )
  
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 4 for calling a global function with example usage: test_builder_code_not_found(code_builder) without return types