code: def test_verify_numpy_ndarray(caplog: LogCaptureFixture):
      partial_check = partial(
          from_example.validate_array, exception_cls=BentoMLException
      )
  
      with pytest.raises(BentoMLException) as ex:
          partial_check(np.array(["asdf"]))
      assert (
          f'Expecting ndarray of dtype "{from_example._dtype}"'
          in str(ex.value)
      )
  
      with pytest.raises(BentoMLException) as e:
          partial_check(np.array([[1]]))
      assert (
          f'Expecting ndarray of shape "{from_example._shape}"'
          in str(e.value)
      )
  
      # test cases where reshape is failed
      example = NumpyNdarray.from_sample(np.ones((2, 2, 3)))
      with caplog.at_level(logging.DEBUG):
          example.validate_array(np.array("asdf"))
      assert "Failed to reshape" in caplog.text
  
imports: from __future__ import annotations
  import logging
  from functools import partial
  from typing import TYPE_CHECKING
  import numpy
  import pytest
  from bentoml._internal.service.openapi.specification import Schema
  from bentoml.exceptions import BadInput
  from bentoml.exceptions import BentoMLException
  from bentoml.grpc.utils import import_generated_stubs
  from bentoml.io import NumpyNdarray
label_desc: Use image node_id 7 for calling a global function with example usage: test_verify_numpy_ndarray(caplog) without return types