class_docstr: Tests for the (reduced) density matrix for matrix.
class_docstr_tok: ["Tests","for","the","(","reduced",")","density","matrix","for","matrix","."]
docstr: Test that wrong shaped state vector raises an error with check_state=True
docstr_tok: ["Test","that","wrong","shaped","state","vector","raises","an","error","with","check_state=True"]
code: def test_matrix_wrong_shape(self):
      """Test that wrong shaped state vector raises an error with check_state=True"""
      density_matrix = [[1, 0, 0], [0, 0, 0], [0, 0, 0]]
  
      with pytest.raises(
          ValueError, match="Density matrix must be of shape"
      ):
          fn.quantum.reduce_dm(
              density_matrix, indices=[0], check_state=True
          )
  
imports: import numpy
  import pytest
  from pennylane import numpy
  from pennylane import math
label_desc: Use image node_id 4 for calling the TestDensityMatrixFromMatrix obj's underlying member method code with example usage: obj.test_matrix_wrong_shape() without return types