class_docstr: Tests for the density matrix function
class_docstr_tok: ["Tests","for","the","density","matrix","function"]
docstr: Test that the return type of the observable is State
docstr_tok: ["Test","that","the","return","type","of","the","observable","is","State"]
code: def test_return_type_is_state(self, dev_name):
      """Test that the return type of the observable is State"""
  
      dev = qml.device(dev_name, wires=2)
  
      @qml.qnode(dev)
      def func():
          qml.Hadamard(0)
          return density_matrix(0)
  
      func()
      obs = func.qtape.observables
      assert len(obs) == 1
      assert obs[0].return_type is State
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import State, Shots, density_matrix, expval, state
label_desc: Use image node_id 2 for calling the TestDensityMatrix obj's underlying member method code with example usage: obj.test_return_type_is_state(dev_name) and returns: density_matrix