code: def test_invalid_dtype():
      with pytest.raises(BentoMLException) as e:
          NumpyNdarray(dtype="asdf")
      assert "Invalid dtype" in str(e.value)
  
      generic = ExampleGeneric("asdf")
      with pytest.raises(BentoMLException) as e:
          _ = NumpyNdarray.from_sample(generic)  # type: ignore (test exception)
      assert "expects a 'numpy.array'" in str(e.value)
  
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 1 for calling a global function with example usage: test_invalid_dtype() without return types