class_docstr: Tests involving matrix validation.
class_docstr_tok: ["Tests","involving","matrix","validation","."]
docstr: Test that if has_matrix if False, then an error must be raised.
docstr_tok: ["Test","that","if","has_matrix","if","False",",","then","an","error","must","be","raised","."]
code: def test_error_not_raised(self):
      """Test that if has_matrix if False, then an error must be raised."""
  
      class BadMat(Operator):
          has_matrix = False
  
          def matrix(self):
              return np.eye(2)
  
      with pytest.raises(
          AssertionError,
          match="If has_matrix is False, the matrix method must raise",
      ):
          assert_valid(BadMat(wires=0), 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 1 for calling the TestBadMatrix obj's underlying member method code with example usage: obj.test_error_not_raised() and returns: np