code: def test_dataset_construction_validates_features_and_targets():
      x = np.random.sample((100, 2))
      tf_dataset = tf.data.Dataset.from_tensors(x)
      tf_tensor = tf.convert_to_tensor(x)
  
      with pytest.raises(
          MlflowException,
          match="features' must be an instance of tf.data.Dataset or a TensorFlow Tensor.*NoneType",
      ):
          mlflow.data.from_tensorflow(features=None)
      with pytest.raises(
          MlflowException,
          match="features' must be an instance of tf.data.Dataset or a TensorFlow Tensor.*str",
      ):
          mlflow.data.from_tensorflow(features="foo")
      with pytest.raises(
          MlflowException,
          match="features' must be an instance of tf.data.Dataset or a TensorFlow Tensor.*str",
      ):
          mlflow.data.from_tensorflow(features="foo", targets=tf_tensor)
  
      mlflow.data.from_tensorflow(features=tf_tensor, targets=tf_tensor)
      mlflow.data.from_tensorflow(features=tf_tensor, targets=None)
      with pytest.raises(
          MlflowException,
          match=(
              "If 'features' is a TensorFlow Tensor, then 'targets' must also be a TensorFlow"
              " Tensor.*str"
          ),
      ):
          mlflow.data.from_tensorflow(features=tf_tensor, targets="foo")
      with pytest.raises(
          MlflowException,
          match=(
              "If 'features' is a TensorFlow Tensor, then 'targets' must also be a TensorFlow"
              " Tensor.*Dataset"
          ),
      ):
          mlflow.data.from_tensorflow(
              features=tf_tensor, targets=tf_dataset
          )
  
      mlflow.data.from_tensorflow(
          features=tf_dataset, targets=tf_dataset
      )
      mlflow.data.from_tensorflow(features=tf_dataset, targets=None)
      with pytest.raises(
          MlflowException,
          match=(
              "If 'features' is an instance of tf.data.Dataset, then 'targets' must also be an"
              " instance of tf.data.Dataset.*str"
          ),
      ):
          mlflow.data.from_tensorflow(
              features=tf_dataset, targets="foo"
          )
      with pytest.raises(
          MlflowException,
          match=(
              "If 'features' is an instance of tf.data.Dataset, then 'targets' must also be an"
              " instance of tf.data.Dataset.*Tensor"
          ),
      ):
          mlflow.data.from_tensorflow(
              features=tf_dataset, targets=tf_tensor
          )
  
imports: import json
  import numpy
  import pytest
  import tensorflow
  import mlflow.data
  from mlflow.data.code_dataset_source import CodeDatasetSource
  from mlflow.data.pyfunc_dataset_mixin import PyFuncInputsOutputs
  from mlflow.data.schema import TensorDatasetSchema
  from mlflow.data.tensorflow_dataset import TensorFlowDataset
  from mlflow.exceptions import MlflowException
  from mlflow.models.evaluation.base import EvaluationDataset
  from mlflow.types.utils import _infer_schema
  from tests.resources.data.dataset_source import TestDatasetSource
label_desc: Use image node_id 1 for calling a global function with example usage: test_dataset_construction_validates_features_and_targets() without return types