code: def test_canonical_version_for_config():
      get_version = dataset_builder.canonical_version_for_config
  
      # No config
      version = get_version(testing.DummyDataset)
      assert version == utils.Version("1.0.0")
  
      class DummyDatasetWithConfig(
          testing.DummyDataset, skip_registration=True
      ):
          BUILDER_CONFIGS = [
              dataset_builder.BuilderConfig(name="x", version="2.0.0"),
              dataset_builder.BuilderConfig(name="y"),
          ]
  
      with pytest.raises(ValueError, match="Cannot infer version"):
          version = get_version(DummyDatasetWithConfig)
  
      version = get_version(
          DummyDatasetWithConfig,
          DummyDatasetWithConfig.builder_configs["x"],
      )
      assert version == utils.Version("2.0.0")
  
      version = get_version(
          DummyDatasetWithConfig,
          DummyDatasetWithConfig.builder_configs["y"],
      )
      assert version == utils.Version("1.0.0")
  
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 4 for calling a global function with example usage: test_canonical_version_for_config() without return types