class_docstr: Tests for the density matrix function
class_docstr_tok: ["Tests","for","the","density","matrix","function"]
docstr: Test that the correct density matrix is returned when all wires are given
docstr_tok: ["Test","that","the","correct","density","matrix","is","returned","when","all","wires","are","given"]
code: def test_correct_density_matrix_all_wires(self, dev_name):
      """Test that the correct density matrix is returned when all wires are given"""
  
      dev = qml.device(dev_name, wires=2)
  
      @qml.qnode(dev)
      def func():
          qml.Hadamard(0)
          qml.CNOT(wires=[0, 1])
          return qml.density_matrix(wires=[0, 1])
  
      density = func()
      expected = np.array(
          [
              [0.5 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j, 0.5 + 0.0j],
              [0.0 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j],
              [0.0 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j],
              [0.5 + 0.0j, 0.0 + 0.0j, 0.0 + 0.0j, 0.5 + 0.0j],
          ]
      )
  
      assert np.allclose(expected, density)
  
      if dev_name != "default.mixed":
          assert np.allclose(
              expected,
              qml.density_matrix(wires=[0, 1]).process_state(
                  state=dev.state, wire_order=dev.wires
              ),
          )
  
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 13 for calling the TestDensityMatrix obj's underlying member method code with example usage: obj.test_correct_density_matrix_all_wires(dev_name) and returns: qml