code: def test_infer_param_schema():
      test_params = {
          "str_param": "str_a",
          "int_param": np.int32(1),
          "bool_param": True,
          "double_param": 1.0,
          "float_param": np.float32(0.1),
          "long_param": np.int64(100),
          "datetime_param": np.datetime64("2023-06-26 00:00:00"),
          "str_list": ["a", "b", "c"],
          "bool_list": [True, False],
          "double_array": np.array([1.0, 2.0]),
          "float_array": np.array([np.float32(0.1), np.float32(0.2)]),
          "long_array": np.array([np.int64(100), np.int64(200)]),
          "datetime_array": np.array([datetime.date(2023, 6, 26)]),
          "str_array": np.array(["a", "b", "c"]),
          "bool_array": np.array([True, False]),
          "int_array": np.array([np.int32(1), np.int32(2)]),
      }
      test_schema = ParamSchema(
          [
              ParamSpec("str_param", DataType.string, "str_a", None),
              ParamSpec(
                  "int_param", DataType.integer, np.int32(1), None
              ),
              ParamSpec("bool_param", DataType.boolean, True, None),
              ParamSpec("double_param", DataType.double, 1.0, None),
              ParamSpec(
                  "float_param", DataType.float, np.float32(0.1), None
              ),
              ParamSpec("long_param", DataType.long, 100, None),
              ParamSpec(
                  "datetime_param",
                  DataType.datetime,
                  np.datetime64("2023-06-26 00:00:00"),
                  None,
              ),
              ParamSpec(
                  "str_list", DataType.string, ["a", "b", "c"], (-1,)
              ),
              ParamSpec(
                  "bool_list", DataType.boolean, [True, False], (-1,)
              ),
              ParamSpec(
                  "double_array", DataType.double, [1.0, 2.0], (-1,)
              ),
              ParamSpec(
                  "float_array",
                  DataType.float,
                  [np.float32(0.1), np.float32(0.2)],
                  (-1,),
              ),
              ParamSpec("long_array", DataType.long, [100, 200], (-1,)),
              ParamSpec(
                  "datetime_array",
                  DataType.datetime,
                  [datetime.date(2023, 6, 26)],
                  (-1,),
              ),
              ParamSpec(
                  "str_array", DataType.string, ["a", "b", "c"], (-1,)
              ),
              ParamSpec(
                  "bool_array", DataType.boolean, [True, False], (-1,)
              ),
              ParamSpec("int_array", DataType.integer, [1, 2], (-1,)),
          ]
      )
      assert _infer_param_schema(test_params) == test_schema
  
      assert _infer_param_schema(
          {"datetime_param": datetime.date(2023, 6, 26)}
      ) == ParamSchema(
          [
              ParamSpec(
                  "datetime_param",
                  DataType.datetime,
                  datetime.date(2023, 6, 26),
                  None,
              )
          ]
      )
  
      # Raise error if parameters is not dictionary
      with pytest.raises(
          MlflowException,
          match=r"Expected parameters to be dict, got list",
      ):
          _infer_param_schema(["a", "str_a", "b", 1])
  
      # Raise error if parameter is bytes
      with pytest.raises(
          MlflowException,
          match=r"Binary type is not supported for parameters",
      ):
          _infer_param_schema({"a": b"str_a"})
  
      # Raise error for invalid parameters types - tuple, 2D array, dictionary
      test_parameters = {
          "a": "str_a",
          "b": (1, 2, 3),
          "c": True,
          "d": [[1, 2], [3, 4]],
          "e": [[[1, 2], [3], []]],
          "f": {"a": 1, "b": 2},
      }
      with pytest.raises(MlflowException, match=r".*") as e:
          _infer_param_schema(test_parameters)
      assert e.match(r"Failed to infer schema for parameters: ")
      assert e.match(
          re.escape(
              "('b', (1, 2, 3), MlflowException('Expected parameters "
              "to be 1D array or scalar, got tuple'))"
          )
      )
      assert e.match(
          re.escape(
              "('d', [[1, 2], [3, 4]], MlflowException('Expected parameters "
              "to be 1D array or scalar, got 2D array'))"
          )
      )
      assert e.match(
          re.escape(
              "('e', [[[1, 2], [3], []]], MlflowException('Expected parameters "
              "to be 1D array or scalar, got 3D array'))"
          )
      )
      assert e.match(
          re.escape(
              "('f', {'a': 1, 'b': 2}, MlflowException('Expected parameters "
              "to be 1D array or scalar, got dict'))"
          )
      )
  
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 32 for calling a global function with example usage: test_infer_param_schema() without return types