code: def test_input_examples(pandas_df_with_all_types, dict_of_ndarrays):
      sig = infer_signature(pandas_df_with_all_types)
      # test setting example with data frame with all supported data types
      with TempDir() as tmp:
          example = _Example(pandas_df_with_all_types)
          example.save(tmp.path())
          filename = example.info["artifact_path"]
          with open(tmp.path(filename)) as f:
              data = json.load(f)
              assert set(data.keys()) == {"columns", "data"}
          parsed_df = dataframe_from_raw_json(
              tmp.path(filename), schema=sig.inputs
          )
          assert (pandas_df_with_all_types == parsed_df).all().all()
          # the frame read without schema should match except for the binary values
          assert (
              (
                  parsed_df.drop(columns=["binary"])
                  == dataframe_from_raw_json(tmp.path(filename)).drop(
                      columns=["binary"]
                  )
              )
              .all()
              .all()
          )
  
      # NB: Drop columns that cannot be encoded by proto_json_utils.pyNumpyEncoder
      new_df = pandas_df_with_all_types.drop(
          columns=["boolean_ext", "integer_ext", "string_ext"]
      )
  
      # pass the input as dictionary instead
      with TempDir() as tmp:
          d = {name: new_df[name].values for name in new_df.columns}
          example = _Example(d)
          example.save(tmp.path())
          filename = example.info["artifact_path"]
          parsed_dict = _read_tensor_input_from_json(tmp.path(filename))
          assert d.keys() == parsed_dict.keys()
          # Asserting binary will fail since it is converted to base64 encoded strings.
          # The check above suffices that the binary input is stored.
          del d["binary"]
          for key in d:
              np.testing.assert_array_equal(d[key], parsed_dict[key])
  
      # input passed as numpy array
      new_df = pandas_df_with_all_types.drop(columns=["binary"])
      for col in new_df:
          input_example = new_df[col].to_numpy()
          with TempDir() as tmp:
              example = _Example(input_example)
              example.save(tmp.path())
              filename = example.info["artifact_path"]
              parsed_ary = _read_tensor_input_from_json(
                  tmp.path(filename)
              )
              np.testing.assert_array_equal(parsed_ary, input_example)
  
      # pass multidimensional array
      for col in dict_of_ndarrays:
          input_example = dict_of_ndarrays[col]
          with TempDir() as tmp:
              example = _Example(input_example)
              example.save(tmp.path())
              filename = example.info["artifact_path"]
              parsed_ary = _read_tensor_input_from_json(
                  tmp.path(filename)
              )
              np.testing.assert_array_equal(parsed_ary, input_example)
  
      # pass multidimensional array as a list
      example = np.array([[1, 2, 3]])
      with pytest.raises(
          TensorsNotSupportedException,
          match=r"Row '0' has shape \(1, 3\)",
      ):
          _Example([example, example])
  
      # pass dict with scalars
      with TempDir() as tmp:
          example = {"a": 1, "b": "abc"}
          x = _Example(example)
          x.save(tmp.path())
          filename = x.info["artifact_path"]
          parsed_df = dataframe_from_raw_json(tmp.path(filename))
          assert example == parsed_df.to_dict(orient="records")[0]
  
imports: import json
  import math
  from unittest import mock
  import numpy
  import pandas
  import pytest
  import sklearn.neighbors
  from scipy.sparse import csc_matrix, csr_matrix
  from sklearn import datasets
  from sklearn.base import BaseEstimator, ClassifierMixin
  import mlflow
  from mlflow.models import Model
  from mlflow.models.signature import ModelSignature, infer_signature
  from mlflow.models.utils import _Example, _read_sparse_matrix_from_json, _read_tensor_input_from_json
  from mlflow.types import DataType
  from mlflow.types.schema import ColSpec, Schema, TensorSpec
  from mlflow.types.utils import TensorsNotSupportedException
  from mlflow.utils.file_utils import TempDir
  from mlflow.utils.proto_json_utils import dataframe_from_raw_json
  from tests.helper_functions import AnyStringWith
label_desc: Use image node_id 7 for calling a global function with example usage: test_input_examples(pandas_df_with_all_types, dict_of_ndarrays) without return types