code: def test_exhaustive_cast(self):
      import PIL.Image
  
      pil_image = PIL.Image.fromarray(
          np.arange(10, dtype=np.uint8).reshape(2, 5)
      )
      with patch(
          "datasets.arrow_writer.cast_to_python_objects",
          side_effect=cast_to_python_objects,
      ) as mock_cast_to_python_objects:
          _ = pa.array(
              TypedSequence(
                  [{"path": None, "bytes": b"image_bytes"}, pil_image],
                  type=Image(),
              )
          )
          args, kwargs = mock_cast_to_python_objects.call_args_list[-1]
          self.assertIn("optimize_list_casting", kwargs)
          self.assertFalse(kwargs["optimize_list_casting"])
  
imports: import copy
  import os
  import tempfile
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
  from datasets.features import Array2D, ClassLabel, Features, Image, Value
  from datasets.features.features import Array2DExtensionType, cast_to_python_objects
  from datasets.keyhash import DuplicatedKeysError, InvalidKeyError
  from .utils import require_pil
label_desc: Use image node_id 12 for calling the TypedSequenceTest obj's underlying member method code with example usage: obj.test_exhaustive_cast() without return types