code: def test_resolve_dataset_source_maintains_consistent_order_and_uses_last_registered_match(
      tmp_path,
  ):
      """This test requires the package in tests/resources/mlflow-test-plugin to be installed"""
  
      from mlflow_test_plugin.dummy_dataset_source import (
          DummyDatasetSource,
      )
  
      class TestDatasetSourceCopy1(TestDatasetSource):
          pass
  
      class TestDatasetSourceCopy2(TestDatasetSource):
          pass
  
      registry1 = DatasetSourceRegistry()
      registry1.register(TestDatasetSource)
      registry1.register(TestDatasetSourceCopy1)
      registry1.register(TestDatasetSourceCopy2)
      source1 = registry1.resolve("test:/" + str(tmp_path))
      assert isinstance(source1, TestDatasetSourceCopy2)
  
      registry2 = DatasetSourceRegistry()
      registry2.register(TestDatasetSource)
      registry2.register(TestDatasetSourceCopy2)
      registry2.register(TestDatasetSourceCopy1)
      source2 = registry2.resolve("test:/" + str(tmp_path))
      assert isinstance(source2, TestDatasetSourceCopy1)
  
      # Verify that a different matching dataset source can still be resolved via `candidates`
      source3 = registry2.resolve(
          "test:/" + str(tmp_path),
          candidate_sources=[TestDatasetSourceCopy2],
      )
      assert isinstance(source3, TestDatasetSourceCopy2)
  
      # Verify that last registered order applies to entrypoints too
      class DummyDatasetSourceCopy(DummyDatasetSource):
          pass
  
      registry3 = DatasetSourceRegistry()
      registry3.register(DummyDatasetSourceCopy)
      source4 = registry3.resolve("dummy:/" + str(tmp_path))
      assert isinstance(source4, DummyDatasetSourceCopy)
      registry3.register_entrypoints()
      source5 = registry3.resolve("dummy:/" + str(tmp_path))
      assert isinstance(source5, DummyDatasetSource)
  
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 5 for calling a global function with example usage: test_resolve_dataset_source_maintains_consistent_order_and_uses_last_registered_match(tmp_path) without return types