code: def test_schema_inference_with_empty_lists():
      # If (non-nested) empty list is passed, should be inferred as string for backward compatibility
      # with version 2.7.1: https://github.com/mlflow/mlflow/blob/v2.7.1/mlflow/types/utils.py#L150
      data = []
      assert _infer_schema(data) == Schema([ColSpec(DataType.string)])
  
      data = [None, "a"]
      assert _infer_schema(data) == Schema([ColSpec(DataType.string)])
  
      data = [["a", "b", "c"], ["a", "b", "c", "d"], None]
      assert _infer_schema(data) == Schema(
          [ColSpec(Array(DataType.string))]
      )
  
      # Nested list contains only an empty list is not allowed.
      data = [[]]
      with pytest.raises(
          MlflowException,
          match=r"A column of nested array type must include at least one non-empty array.",
      ):
          _infer_schema(data)
  
      # This case is also considered as empty list, because None and np.nan are skipped.
      data = [[None, np.nan]]
      with pytest.raises(
          MlflowException,
          match=r"A column of nested array type must include at least one non-empty array.",
      ):
          _infer_schema(data)
  
      # If at least one of sublists is not empty, we can assume other empty lists have the same type.
      data = [
          {
              "data": [
                  ["a", "b", "c"],
                  [],
                  ["d", "e"],
                  [],
              ]
          }
      ]
      inferred_schema = _infer_schema(data)
      expected_schema = Schema(
          [ColSpec(Array(Array(DataType.string)), name="data")]
      )
      assert inferred_schema == expected_schema
  
      # Complex case for deeply nested array
      data = [
          {
              "data": [
                  [["a", "b", "c"], [], ["d"]],
                  [[], ["e"]],
                  [
                      [],
                      [],
                      [],
                  ],
              ]
          }
      ]
      inferred_schema = _infer_schema(data)
      expected_schema = Schema(
          [ColSpec(Array(Array(Array(DataType.string))), name="data")]
      )
      assert inferred_schema == expected_schema
  
      # Property value cannot be an empty list
      data = [{"data": {"key": []}}]
      with pytest.raises(
          MlflowException,
          match=r"Dictionary value must not be an empty list.",
      ):
          _infer_schema(data)
  
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 49 for calling a global function with example usage: test_schema_inference_with_empty_lists() without return types