code: def test_handle_kfv2(envelope_kfv2, context, image_bytes):
      image = Image.open(io.BytesIO(image_bytes))
      image_list = image_processing(image).tolist()
      test_data = {
          "body": {
              "id": "test-id",
              "inputs": [
                  {
                      "data": image_list,
                      "datatype": "FP32",
                      "name": "test-input",
                      "shape": [1, 28, 28],
                  }
              ],
          }
      }
  
      # testing for v2predict API
      results = envelope_kfv2.handle([test_data], context)
      print(results)
      assert results[0]["outputs"][0]["data"][0] in range(0, 9)
  
file_path: serve/ts/torch_handler/unit_tests/test_mnist_kf.py
imports: import io
  import shutil
  import sys
  from pathlib import Path
  import pytest
  import torchvision.transforms
  from PIL import Image
  from examples.image_classifier.mnist.mnist_handler import MNISTDigitClassifier
  from ts.torch_handler.request_envelope import kserve, kservev2
  from .test_utils.mock_context import MockContext
label_desc: Use image node_id 8 for calling a global function with example usage: test_handle_kfv2(envelope_kfv2, context, image_bytes) without return types