code: def test_load_from_json_throws_for_unrecognized_source_type(tmp_path):
      registry = DatasetSourceRegistry()
      registry.register(TestDatasetSource)
  
      with pytest.raises(
          MlflowException, match="unrecognized source type: foo"
      ):
          registry.get_source_from_json(
              source_json='{"bar": "123"}', source_type="foo"
          )
  
      class CandidateDatasetSource1(TestDatasetSource):
          @staticmethod
          def _get_source_type() -> str:
              return "candidate1"
  
          @staticmethod
          def _can_resolve(raw_source: Any) -> bool:
              return raw_source.startswith("candidate1")
  
      class CandidateDatasetSource2(CandidateDatasetSource1):
          @staticmethod
          def _get_source_type() -> str:
              return "candidate2"
  
          @staticmethod
          def _can_resolve(raw_source: Any) -> bool:
              return raw_source.startswith("candidate2")
  
      registry = DatasetSourceRegistry()
      registry.register(TestDatasetSource)
      registry.register(CandidateDatasetSource1)
      registry.register(CandidateDatasetSource2)
  
      registry.resolve("test:" + str(tmp_path))
      registry.resolve(
          "test:" + str(tmp_path), candidate_sources=[TestDatasetSource]
      )
      with pytest.raises(
          MlflowException,
          match="Could not find a source information resolver",
      ):
          # TestDatasetSource is the only source that can resolve raw sources with scheme "test",
          # and TestDatasetSource is not a subclass of CandidateDatasetSource1
          registry.resolve(
              "test:" + str(tmp_path),
              candidate_sources=[CandidateDatasetSource1],
          )
  
      registry.resolve("candidate1:" + str(tmp_path))
      registry.resolve(
          "candidate1:" + str(tmp_path),
          candidate_sources=[CandidateDatasetSource1],
      )
      # CandidateDatasetSource1 is a subclass of TestDatasetSource and is therefore considered
      # as a candidate for resolution
      registry.resolve(
          "candidate1:" + str(tmp_path),
          candidate_sources=[TestDatasetSource],
      )
      with pytest.raises(
          MlflowException,
          match="Could not find a source information resolver",
      ):
          # CandidateDatasetSource2 is not a superclass of CandidateDatasetSource1 or
          # TestDatasetSource and cannot resolve raw sources with scheme "candidate1"
          registry.resolve(
              "candidate1:" + str(tmp_path),
              candidate_sources=[CandidateDatasetSource2],
          )
  
file_path: mlflow/tests/data/test_dataset_source_registry.py
imports: from typing import Any
  from unittest import mock
  import pytest
  from mlflow.data.dataset_source_registry import DatasetSourceRegistry
  from mlflow.exceptions import MlflowException
  from tests.resources.data.dataset_source import TestDatasetSource
label_desc: Use image node_id 4 for calling a global function with example usage: test_load_from_json_throws_for_unrecognized_source_type(tmp_path) and returns: str, raw_source, str, raw_source