code: def test_builder_cls(
      dummy_register,
  ):  # pylint: disable=redefined-outer-name
      # The dataset will be installed in the cache
      installed_path = cache.cache_path()
      installed_path /= "modules/tfds_community/kaggle/dummy_dataset"
      assert not installed_path.exists()
  
      ds_name = naming.DatasetName("kaggle:dummy_dataset")
      builder_cls = dummy_register.builder_cls(ds_name)
      assert builder_cls.name == "dummy_dataset"
  
      clshash = "d183643ab2f6544350b6871f6cc2b0fba07297d8d30f4c04649a7717e44e531b"
      assert (
          installed_path / f"{clshash}/dummy_dataset.py"
          == builder_cls.code_path
      )
      assert "kaggle" in builder_cls.code_path.parts
      assert issubclass(builder_cls, dataset_builder.DatasetBuilder)
      assert (
          not builder_cls.url_infos
      )  # No checksums installed with the package
  
      # Dataset installed in the cache
      # Filename should be deterministic
      assert list(sorted(installed_path.iterdir())) == [
          installed_path / clshash
      ]
  
      # Reusing the dataset should re-use the cache
      with mock.patch.object(
          register_package,
          "_download_and_cache",
          side_effect=ValueError(
              "Dataset should have been cached already"
          ),
      ):
          ds_name = naming.DatasetName("kaggle:dummy_dataset")
          builder_cls2 = dummy_register.builder_cls(ds_name)
      assert builder_cls is builder_cls2
  
      # Datasets from different namespace can have the same name
      ds_name = naming.DatasetName("mlds:dummy_dataset")
      builder_cls = dummy_register.builder_cls(ds_name)
      assert "mlds" in builder_cls.code_path.parts
      assert issubclass(builder_cls, dataset_builder.DatasetBuilder)
      # Checksums have been correctly installed
      assert "http://dummy.org/data.txt" in builder_cls.url_infos
  
      with pytest.raises(registered.DatasetNotFoundError):
          dummy_register.builder(naming.DatasetName("other:ds0"))
  
imports: import contextlib
  import datetime
  import json
  import os
  import pathlib
  import sys
  import tempfile
  import textwrap
  from typing import Iterator
  from unittest import mock
  from etils import epath
  import pytest
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.community import cache
  from tensorflow_datasets.core.community import dataset_sources
  from tensorflow_datasets.core.community import register_package
label_desc: Use image node_id 4 for calling a global function with example usage: test_builder_cls(dummy_register) without return types