class_docstr: Tests for the density matrix function
class_docstr_tok: ["Tests","for","the","density","matrix","function"]
docstr: Test that the shape is correct for qml.density_matrix.
docstr_tok: ["Test","that","the","shape","is","correct","for","qml.density_matrix","."]
code: def test_shape(self, shots):
      """Test that the shape is correct for qml.density_matrix."""
      dev = qml.device("default.qubit.legacy", wires=3, shots=shots)
      res = qml.density_matrix(wires=[0, 1])
      assert res.shape(dev, Shots(shots)) == (2**2, 2**2)
  
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 19 for calling the TestDensityMatrix obj's underlying member method code with example usage: obj.test_shape(shots) without return types