code: def test_enforce_array_with_errors():
      with pytest.raises(
          MlflowException,
          match=r"Expected data to be list or numpy array, got str",
      ):
          _enforce_array("abc", Array(DataType.string))
  
      with pytest.raises(
          MlflowException,
          match=r"Failed to enforce schema of data `123` with dtype `string`",
      ):
          _enforce_array([123, 456, 789], Array(DataType.string))
  
      # Nested array with mixed type elements
      with pytest.raises(
          MlflowException,
          match=r"Failed to enforce schema of data `1` with dtype `string`",
      ):
          _enforce_array(
              [["a", "b"], [1, 2]], Array(Array(DataType.string))
          )
  
      # Nested array with different nest level
      with pytest.raises(
          MlflowException,
          match=r"Expected data to be list or numpy array, got str",
      ):
          _enforce_array(
              [["a", "b"], "c"], Array(Array(DataType.string))
          )
  
      # Missing priperties in Object
      with pytest.raises(
          MlflowException, match=r"Missing required properties: {'b'}"
      ):
          _enforce_array(
              [
                  {"a": "some_sentence1", "b": "some_sentence2"},
                  {
                      "a": "some_sentence3",
                      "c": ["some_sentence4", "some_sentence5"],
                  },
              ],
              Array(
                  Object(
                      [
                          Property("a", DataType.string),
                          Property("b", DataType.string),
                      ]
                  )
              ),
          )
  
      # Extra properties
      with pytest.raises(
          MlflowException,
          match=r"Invalid properties not defined in the schema found: {'c'}",
      ):
          _enforce_array(
              [
                  {"a": "some_sentence1", "b": "some_sentence2"},
                  {
                      "a": "some_sentence3",
                      "c": ["some_sentence4", "some_sentence5"],
                  },
              ],
              Array(
                  Object(
                      [
                          Property("a", DataType.string),
                          Property(
                              "b", DataType.string, required=False
                          ),
                      ]
                  )
              ),
          )
  
imports: import random
  from collections import namedtuple
  from unittest import mock
  import numpy
  import pytest
  import sklearn.neighbors
  from sklearn import datasets
  import mlflow
  from mlflow import MlflowClient
  from mlflow.entities.model_registry import ModelVersion
  from mlflow.exceptions import MlflowException
  from mlflow.models import add_libraries_to_model
  from mlflow.models.utils import _enforce_array, _enforce_datatype, _enforce_object, _enforce_property, get_model_version_from_model_uri
  from mlflow.types import DataType
  from mlflow.types.schema import Array, Object, Property
label_desc: Use image node_id 16 for calling a global function with example usage: test_enforce_array_with_errors() without return types