class_docstr: Tests for computing the purity of a given state
class_docstr_tok: ["Tests","for","computing","the","purity","of","a","given","state"]
docstr: Test purity for different density matrices.
docstr_tok: ["Test","purity","for","different","density","matrices","."]
code: def test_density_matrices_purity_single_wire(
      self,
      density_matrix,
      wires,
      check_state,
      subsystems_purity,
      _,
      interface,
  ):
      """Test purity for different density matrices."""
  
      if interface:
          density_matrix = qml.math.asarray(
              density_matrix, like=interface
          )
  
      purity = qml.math.purity(
          density_matrix, wires, check_state=check_state
      )
      assert qml.math.allclose(purity, subsystems_purity)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestPurity obj's underlying member method code with example usage: obj.test_density_matrices_purity_single_wire(density_matrix, wires, check_state, subsystems_purity, _, interface) without return types