code: def test_bad_dtype():
      codec = CompressedImageCodec("png")
      assert codec.image_codec == "png"
      field = UnischemaField(
          name="field_image",
          numpy_dtype=np.uint8,
          shape=(10, 20),
          codec=codec,
          nullable=False,
      )
      with pytest.raises(ValueError, match="Unexpected type"):
          codec.encode(field, np.zeros((100, 200), dtype=np.uint16))
  
file_path: petastorm/petastorm/tests/test_codec_compressed_image.py
imports: import io
  import numpy
  import pytest
  from PIL import Image
  from petastorm.codecs import CompressedImageCodec
  from petastorm.unischema import UnischemaField
label_desc: Use image node_id 5 for calling a global function with example usage: test_bad_dtype() without return types