code: def test_enforce_tensor_spec_variable_signature():
      standard_array = np.array(
          [[[1, 2, 3], [1, 2, 3]], [[1, 2, 3], [1, 2, 3]]],
          dtype=np.int32,
      )
      ragged_array = np.array(
          [[[1, 2, 3], [1, 2, 3]], [[1, 2, 3]]], dtype=object
      )
      inferred_schema = _infer_schema(ragged_array)
      inferred_spec = inferred_schema.inputs[0]
      assert inferred_spec.shape == (-1,)
      assert inferred_spec.type == np.dtype(object)
  
      result_array = _enforce_tensor_spec(standard_array, inferred_spec)
      np.testing.assert_array_equal(standard_array, result_array)
      result_array = _enforce_tensor_spec(ragged_array, inferred_spec)
      np.testing.assert_array_equal(ragged_array, result_array)
  
      manual_spec = TensorSpec(np.dtype(np.int32), (-1, -1, 3))
      result_array = _enforce_tensor_spec(standard_array, manual_spec)
      np.testing.assert_array_equal(standard_array, result_array)
      result_array = _enforce_tensor_spec(ragged_array, manual_spec)
      np.testing.assert_array_equal(ragged_array, result_array)
  
      standard_spec = _infer_schema(standard_array).inputs[0]
      assert standard_spec.shape == (-1, 2, 3)
  
      result_array = _enforce_tensor_spec(standard_array, standard_spec)
      np.testing.assert_array_equal(standard_array, result_array)
      with pytest.raises(
          MlflowException,
          match=re.escape(
              r"Shape of input (2,) does not match expected shape (-1, 2, 3)."
          ),
      ):
          _enforce_tensor_spec(ragged_array, standard_spec)
  
imports: import datetime
  import json
  import math
  import re
  import numpy
  import pandas
  import pyspark
  import pyspark.sql.types
  import pytest
  from scipy.sparse import csc_matrix, csr_matrix
  from mlflow.exceptions import MlflowException
  from mlflow.models.utils import _enforce_tensor_spec
  from mlflow.pyfunc import _parse_spark_datatype
  from mlflow.types import DataType
  from mlflow.types.schema import Array, ColSpec, Object, ParamSchema, ParamSpec, Property, Schema, TensorSpec
  from mlflow.types.utils import _get_tensor_shape, _infer_colspec_type, _infer_param_schema, _infer_schema, _validate_input_dictionary_contains_only_strings_and_lists_of_strings
label_desc: Use image node_id 27 for calling a global function with example usage: test_enforce_tensor_spec_variable_signature() without return types