code: def test_reset_data_shape(self):
      shape1 = 10, 10
      shape3 = 10, 10, 3
  
      # Init data (explicit shape)
      data = np.zeros((10, 10, 1), dtype=np.uint8)
      T = Texture2D(data=data)
      assert T.shape == (10, 10, 1)
      assert T.format == "luminance"
  
      # Set data to rgb
      T.set_data(np.zeros(shape3, np.uint8))
      assert T.shape == (10, 10, 3)
      assert T.format == "rgb"
  
      # Set data to grayscale
      T.set_data(np.zeros(shape1, np.uint8))
      assert T.shape == (10, 10, 1)
      assert T.format == "luminance"
  
      # Set size to rgb
      T.resize(shape3)
      assert T.shape == (10, 10, 3)
      assert T._format == "rgb"
  
      # Set size to grayscale
      T.resize(shape1)
      assert T.shape == (10, 10, 1)
      assert T._format == "luminance"
  
      # Keep using old format
      T.resize(shape1, "alpha")
      T.resize(shape1)
      assert T._format == "alpha"
  
      # Use luminance as default
      T.resize(shape3)
      T.resize(shape1)
      assert T._format == "luminance"
  
      # Too large
      self.assertRaises(ValueError, T.resize, (5, 5, 5, 1))
      # Cannot determine format
      self.assertRaises(ValueError, T.resize, (5, 5, 5))
      # Invalid format
      self.assertRaises(ValueError, T.resize, shape3, "foo")
      self.assertRaises(ValueError, T.resize, shape3, "alpha")
  
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 11 for calling the Texture2DTest obj's underlying member method code with example usage: obj.test_reset_data_shape() without return types