class_docstr: Tests involving matrix validation.
class_docstr_tok: ["Tests","involving","matrix","validation","."]
docstr: Test an error if the matrix is of the wrong shape.
docstr_tok: ["Test","an","error","if","the","matrix","is","of","the","wrong","shape","."]
code: def test_bad_matrix_shape(self):
      """Test an error if the matrix is of the wrong shape."""
  
      class BadMat(Operator):
          @staticmethod
          def compute_matrix():
              return np.eye(2)
  
      with pytest.raises(
          AssertionError,
          match=r"matrix must be two dimensional with shape \(4, 4\)",
      ):
          assert_valid(BadMat(wires=(0, 1)), skip_pickle=True)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.operation import Operator
  from pennylane.ops.functions import assert_valid
label_desc: Use image node_id 2 for calling the TestBadMatrix obj's underlying member method code with example usage: obj.test_bad_matrix_shape() and returns: np