class_docstr: Tests for the (reduced) density matrix for QNodes returning states.
docstr: Test that the QNode of reduced_dm function must return state.
docstr_tok: ["Test","that","the","QNode","of","reduced_dm","function","must","return","state","."]
code: def test_qnode_not_returning_state(self):
      """Test that the QNode of reduced_dm function must return state."""
      dev = qml.device("default.qubit", wires=1)
  
      @qml.qnode(dev)
      def circuit():
          qml.RZ(0, wires=[0])
          return qml.expval(qml.PauliX(wires=0))
  
      with pytest.raises(
          ValueError, match="The qfunc measurement needs to be State"
      ):
          qml.qinfo.reduced_dm(circuit, wires=[0])()
  
file_path: pennylane/tests/qinfo/test_reduced_dm.py
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 4 for calling the TestDensityMatrixQNode obj's underlying member method code with example usage: obj.test_qnode_not_returning_state() and returns: qml