code: def _test_texture_internalformats(Texture, baseshape):
      # Test format for concrete Texture class and baseshape + (numchannels,)
      # Test internalformats valid with desktop OpenGL
  
      formats = [
          (1, "red", ["red", "r8", "r16", "r16f", "r32f"]),
          (2, "rg", ["rg", "rg8", "rg16", "rg16f", "rg32f"]),
          (3, "rgb", ["rgb", "rgb8", "rgb16", "rgb16f", "rgb32f"]),
          (
              4,
              "rgba",
              ["rgba", "rgba8", "rgba16", "rgba16f", "rgba32f"],
          ),
          (1, "depth_component", ["depth_component"]),
      ]
  
      for channels in range(1, 5):
          for fmt, ifmts in [
              (f, iL) for n, f, iL in formats if n == channels
          ]:
              shape = baseshape + (channels,)
              data = np.zeros(shape, dtype=np.uint8)
              for ifmt in ifmts:
                  T = Texture(
                      shape=shape, format=fmt, internalformat=ifmt
                  )
                  assert "Texture" in repr(T)
                  assert T._shape == shape
                  T = Texture(
                      data=data, format=fmt, internalformat=ifmt
                  )
                  assert "Texture" in repr(T)
                  assert T._shape == shape
  
      for channels in range(1, 5):
          for fmt, ifmts in [
              (f, iL) for n, f, iL in formats if n != channels
          ]:
              shape = baseshape + (channels,)
              data = np.zeros(shape, dtype=np.uint8)
              for ifmt in ifmts:
                  assert_raises(
                      ValueError,
                      Texture,
                      shape=shape,
                      format=fmt,
                      internalformat=ifmt,
                  )
                  assert_raises(
                      ValueError,
                      Texture,
                      data=data,
                      format=fmt,
                      internalformat=ifmt,
                  )
  
imports: import unittest
  import numpy
  import pytest
  from vispy.gloo import Texture1D, Texture2D, Texture3D, TextureAtlas
  from vispy.testing import requires_pyopengl, run_tests_if_main, assert_raises
label_desc: Use image node_id 12 for calling a global function with example usage: _test_texture_internalformats(Texture, baseshape) without return types