code: def test_image_nan_single_band(texture_format):
      size = (40, 40)
      data = np.ones((40, 40))
      data[:5, :5] = np.nan
      data[:5, -5:] = 0
  
      expected = (np.ones((40, 40, 4)) * 255).astype(np.uint8)
      # black square
      expected[:5, -5:, :3] = 0
      if texture_format is None:
          # CPU scaling's NaNs get converted to 0s
          expected[:5, :5, :3] = 0
      else:
          # GPU receives NaNs
          # nan - transparent square
          expected[:5, :5, 0] = 0
          expected[:5, :5, 1] = 255  # match the 'green' background
          expected[:5, :5, 2] = 0
  
      with TestingCanvas(size=size[::-1], bgcolor=(0, 1, 0)) as c:
          Image(
              data,
              cmap="grays",
              texture_format=texture_format,
              parent=c.scene,
          )
          rendered = c.render()
          np.testing.assert_allclose(rendered, expected)
  
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 7 for calling a global function with example usage: test_image_nan_single_band(texture_format) without return types