class_docstr: Tests for the trace distance function between two states (state vectors or density matrix).
class_docstr_tok: ["Tests","for","the","trace","distance","function","between","two","states","(","state","vectors","or","density","matrix",")","."]
docstr: Test that a message is raised when the density matrix does not have the right shape.
docstr_tok: ["Test","that","a","message","is","raised","when","the","density","matrix","does","not","have","the","right","shape","."]
code: def test_density_matrix_wrong_shape(self, states):
      """Test that a message is raised when the density matrix does not have the right shape."""
      state0, state1 = states
  
      with pytest.raises(
          ValueError, match="Density matrix must be of shape"
      ):
          qml.math.trace_distance(state0, state1, check_state=True)
  
      with pytest.raises(
          ValueError, match="Density matrix must be of shape"
      ):
          qml.math.trace_distance(state1, state0, check_state=True)
  
file_path: pennylane/tests/math/test_trace_distance_math.py
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 3 for calling the TestTraceDistanceMath obj's underlying member method code with example usage: obj.test_density_matrix_wrong_shape(states) without return types