code: def _set_image_data(image, data, should_fail):
      if should_fail:
          pytest.raises(ValueError, image.set_data, data)
          return
      image.set_data(data)
  
file_path: vispy/vispy/visuals/tests/test_image.py
imports: from unittest import mock
  from vispy.scene import Image, PanZoomCamera
  from vispy.testing import requires_application, TestingCanvas, run_tests_if_main, IS_CI
  from vispy.testing.image_tester import assert_image_approved, downsample
  import numpy
  import pytest
  from vispy.testing.rendered_array_tester import compare_render, max_for_dtype
label_desc: Use image node_id 4 for calling a global function with example usage: _set_image_data(image, data, should_fail) without return types