code: def test_all_numpy_dtypes():
      def test_dtype(nparray, dtype):
          schema = _infer_schema(nparray)
          assert schema == Schema([TensorSpec(np.dtype(dtype), (-1,))])
          spec = schema.inputs[0]
          recreated_spec = TensorSpec.from_json_dict(**spec.to_dict())
          assert spec == recreated_spec
          enforced_array = _enforce_tensor_spec(nparray, spec)
          assert isinstance(enforced_array, np.ndarray)
  
      bool_ = ["bool", "bool_", "bool8"]
      object_ = ["object"]
      signed_int = [
          "byte",
          "int8",
          "short",
          "int16",
          "intc",
          "int32",
          "int_",
          "int",
          "intp",
          "int64",
          "longlong",
      ]
      unsigned_int = [
          "ubyte",
          "uint8",
          "ushort",
          "uint16",
          "uintc",
          "uint32",
          "uint",
          "uintp",
          "uint64",
          "ulonglong",
      ]
      floating = [
          "half",
          "float16",
          "single",
          "float32",
          "double",
          "float_",
          "float64",
      ]
      complex_ = [
          "csingle",
          "singlecomplex",
          "complex64",
          "cdouble",
          "cfloat",
          "complex_",
          "complex128",
      ]
      bytes_ = ["bytes_", "string_"]
      str_ = ["str_", "unicode_"]
      platform_dependent = [
          # Complex
          "clongdouble",
          "clongfloat",
          "longcomplex",
          "complex256",
          # Float
          "longdouble",
          "longfloat",
          "float128",
      ]
  
      # test boolean
      for dtype in bool_:
          test_dtype(np.array([True, False, True], dtype=dtype), dtype)
          test_dtype(np.array([123, 0, -123], dtype=dtype), dtype)
  
      # test object
      for dtype in object_:
          test_dtype(np.array([True, False, True], dtype=dtype), dtype)
          test_dtype(np.array([123, 0, -123.544], dtype=dtype), dtype)
          test_dtype(
              np.array(["test", "this", "type"], dtype=dtype), dtype
          )
          test_dtype(
              np.array(["test", 123, "type"], dtype=dtype), dtype
          )
          test_dtype(
              np.array(["test", 123, 234 + 543j], dtype=dtype), dtype
          )
  
      # test signedInt_
      for dtype in signed_int:
          test_dtype(np.array([1, 2, 3, -5], dtype=dtype), dtype)
  
      # test unsignedInt_
      for dtype in unsigned_int:
          test_dtype(np.array([1, 2, 3, 5], dtype=dtype), dtype)
  
      # test floating
      for dtype in floating:
          test_dtype(
              np.array([1.1, -2.2, 3.3, 5.12], dtype=dtype), dtype
          )
  
      # test complex
      for dtype in complex_:
          test_dtype(
              np.array([1 + 2j, -2.2 - 3.6j], dtype=dtype), dtype
          )
  
      # test bytes_
      for dtype in bytes_:
          test_dtype(
              np.array([bytes([1, 255, 12, 34])], dtype=dtype), dtype
          )
      # Explicitly giving size information for flexible dtype bytes
      test_dtype(np.array([bytes([1, 255, 12, 34])], dtype="S10"), "S")
      test_dtype(
          np.array([bytes([1, 255, 12, 34])], dtype="S10"), "bytes"
      )
  
      # str_
      for dtype in str_:
          test_dtype(
              np.array(["m", "l", "f", "l", "o", "w"], dtype=dtype),
              dtype,
          )
          test_dtype(np.array(["mlflow"], dtype=dtype), dtype)
          test_dtype(
              np.array(["mlflow is the best"], dtype=dtype), dtype
          )
      # Explicitly giving size information for flexible dtype str_
      test_dtype(np.array(["a", "bc", "def"], dtype="U16"), "str")
      test_dtype(np.array(["a", "bc", "def"], dtype="U16"), "U")
  
      # test datetime
      test_dtype(
          np.array(
              [
                  "2021-01-01 00:00:00",
                  "2021-02-02 00:00:00",
                  "2021-03-03 12:00:00",
              ],
              dtype="datetime64",
          ),
          "datetime64[s]",
      )
  
      # platform_dependent
      for dtype in platform_dependent:
          if hasattr(np, dtype):
              test_dtype(
                  np.array([1.1, -2.2, 3.3, 5.12], dtype=dtype), dtype
              )
  
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 23 for calling a global function with example usage: test_all_numpy_dtypes() without return types