code: def _test_texture_formats(Texture, baseshape, formats):
      # valid channel count and format combinations
      for channels in range(1, 5):
          for format in [f for n, f in formats if n == channels]:
              shape = baseshape + (channels,)
              T = Texture(shape=shape, format=format)
              assert "Texture" in repr(T)
              assert T._shape == shape
              data = np.zeros(shape, dtype=np.uint8)
              T = Texture(data=data, format=format)
              assert "Texture" in repr(T)
              assert T._shape == shape
  
      # invalid channel count and format combinations
      for channels in range(1, 5):
          for format in [
              f for n, f in formats + [(5, "junk")] if n != channels
          ]:
              shape = baseshape + (channels,)
              assert_raises(
                  ValueError, Texture, shape=shape, format=format
              )
              data = np.zeros(shape, dtype=np.uint8)
              assert_raises(
                  ValueError, Texture, data=data, format=format
              )
  
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 3 for calling a global function with example usage: _test_texture_formats(Texture, baseshape, formats) without return types