code: def test_register_constructor_and_call(
      dataset_registry, dataset_source_registry, tmp_path
  ):  # pylint: disable=unused-argument
      dataset_source_registry.register(TestDatasetSource)
  
      def from_test(
          data_list, source, name=None, digest=None
      ) -> TestDataset:
          resolved_source: TestDatasetSource = resolve_dataset_source(
              source, candidate_sources=[TestDatasetSource]
          )
          return TestDataset(
              data_list=data_list,
              source=resolved_source,
              name=name,
              digest=digest,
          )
  
      register_constructor(constructor_fn=from_test)
      register_constructor(
          constructor_name="from_test_2", constructor_fn=from_test
      )
  
      dataset1 = mlflow.data.from_test(
          data_list=[1, 2, 3],
          # Use a TestDatasetSourceURI
          source="test:" + str(tmp_path),
          name="name1",
          digest="digest1",
      )
      assert isinstance(dataset1, TestDataset)
      assert dataset1.data_list == [1, 2, 3]
      assert dataset1.name == "name1"
      assert dataset1.digest == "digest1"
  
      dataset2 = mlflow.data.from_test_2(
          data_list=[4, 5, 6],
          # Use a TestDatasetSourceURI
          source="test:" + str(tmp_path),
          name="name2",
          digest="digest2",
      )
      assert isinstance(dataset2, TestDataset)
      assert dataset2.data_list == [4, 5, 6]
      assert dataset2.name == "name2"
      assert dataset2.digest == "digest2"
  
file_path: mlflow/tests/data/test_dataset_registry.py
imports: from typing import Optional
  from unittest import mock
  import pytest
  import mlflow.data
  from mlflow.data.dataset import Dataset
  from mlflow.data.dataset_registry import DatasetRegistry, register_constructor
  from mlflow.data.dataset_source_registry import DatasetSourceRegistry, resolve_dataset_source
  from mlflow.exceptions import MlflowException
  from tests.resources.data.dataset import TestDataset
  from tests.resources.data.dataset_source import TestDatasetSource
label_desc: Use image node_id 5 for calling a global function with example usage: test_register_constructor_and_call(dataset_registry, dataset_source_registry, tmp_path) and returns: TestDataset