code: def test_input_examples_with_nan(
      df_with_nan, dict_of_ndarrays_with_nans
  ):
      # test setting example with data frame with NaN values in it
      sig = infer_signature(df_with_nan)
      with TempDir() as tmp:
          example = _Example(df_with_nan)
          example.save(tmp.path())
          filename = example.info["artifact_path"]
          assert example.info["type"] == "dataframe"
          assert example.info["pandas_orient"] == "split"
          with open(tmp.path(filename)) as f:
              data = json.load(f)
              assert set(data.keys()) == {"columns", "data"}
              pd.read_json(
                  json.dumps(data), orient=example.info["pandas_orient"]
              )
  
          parsed_df = dataframe_from_raw_json(
              tmp.path(filename), schema=sig.inputs
          )
  
          # by definition of NaN, NaN == NaN is False but NaN != NaN is True
          assert (
              (
                  (df_with_nan == parsed_df)
                  | (
                      (df_with_nan != df_with_nan)
                      & (parsed_df != parsed_df)
                  )
              )
              .all()
              .all()
          )
          # the frame read without schema should match except for the binary values
          no_schema_df = dataframe_from_raw_json(tmp.path(filename))
          a = parsed_df.drop(columns=["binary"])
          b = no_schema_df.drop(columns=["binary"])
          assert ((a == b) | ((a != a) & (b != b))).all().all()
  
      # pass multidimensional array
      for col in dict_of_ndarrays_with_nans:
          input_example = dict_of_ndarrays_with_nans[col]
          sig = infer_signature(input_example)
          with TempDir() as tmp:
              example = _Example(input_example)
              example.save(tmp.path())
              filename = example.info["artifact_path"]
              assert example.info["type"] == "ndarray"
              parsed_ary = _read_tensor_input_from_json(
                  tmp.path(filename), schema=sig.inputs
              )
              assert np.array_equal(
                  parsed_ary, input_example, equal_nan=True
              )
  
              # without a schema/dtype specified, the resulting tensor will keep the None type
              no_schema_df = _read_tensor_input_from_json(
                  tmp.path(filename)
              )
              np.testing.assert_array_equal(
                  no_schema_df,
                  np.where(
                      np.isnan(input_example), None, input_example
                  ),
              )
  
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 10 for calling a global function with example usage: test_input_examples_with_nan(df_with_nan, dict_of_ndarrays_with_nans) without return types