code: def test_volume_set_data_different_dtype():
      size = (80, 80)
      data = np.array([[[0, 127]]], dtype=np.int8)
      left = (40, 10)
      right = (40, 70)
      white = (255, 255, 255, 255)
      black = (0, 0, 0, 255)
  
      with TestingCanvas(size=size[::-1], bgcolor="w") as c:
          view = c.central_widget.add_view()
          view.camera = "arcball"
          view.camera.fov = 0
          view.camera.center = 0.5, 0, 0
          view.camera.scale_factor = 2
          volume = scene.visuals.Volume(
              data, cmap="grays", clim=[0, 127], parent=view.scene
          )
  
          render = c.render()
          assert np.allclose(render[left], black)
          assert np.allclose(render[right], white)
  
          # same data as float should change nothing
          volume.set_data(data.astype(np.float32))
          render = c.render()
          assert np.allclose(render[left], black)
          assert np.allclose(render[right], white)
  
          # something inverted, different dtype
          new_data = np.array([[[127, 0]]], dtype=np.float16)
          volume.set_data(new_data)
          render = c.render()
          assert np.allclose(render[left], white)
          assert np.allclose(render[right], black)
  
          # out of bounds should clip (2000 > 127)
          new_data = np.array([[[0, 2000]]], dtype=np.float64)
          volume.set_data(new_data)
          render = c.render()
          assert np.allclose(render[left], black)
          assert np.allclose(render[right], white)
  
imports: import pytest
  import numpy
  from vispy import scene
  from vispy.testing import TestingCanvas, requires_application, run_tests_if_main, requires_pyopengl, raises
  from vispy.testing.image_tester import assert_image_approved, downsample
  from vispy.testing.rendered_array_tester import compare_render, max_for_dtype
label_desc: Use image node_id 15 for calling a global function with example usage: test_volume_set_data_different_dtype() without return types