class_docstr: Test the purity meausrement with qnodes and devices.
class_docstr_tok: ["Test","the","purity","meausrement","with","qnodes","and","devices","."]
docstr: Tests purity for a qnode
docstr_tok: ["Tests","purity","for","a","qnode"]
code: def test_IsingXX_qnode_purity_torch(
      self, param, wires, is_partial, interface
  ):
      """Tests purity for a qnode"""
  
      import torch
  
      dev = qml.device("default.qubit.legacy", wires=2)
  
      @qml.qnode(dev, interface=interface)
      def circuit(x):
          qml.IsingXX(x, wires=[0, 1])
          return qml.purity(wires=wires)
  
      purity = circuit(torch.tensor(param))
      expected_purity = (
          expected_purity_ising_xx(param) if is_partial else 1
      )
      assert qml.math.allclose(purity, expected_purity)
  
file_path: pennylane/tests/measurements/legacy/test_purity_measurement_legacy.py
imports: import pytest
  import numpy
  import pennylane
  from pennylane.measurements import Shots
label_desc: Use image node_id 7 for calling the TestPurityIntegration obj's underlying member method code with example usage: obj.test_IsingXX_qnode_purity_torch(param, wires, is_partial, interface) and returns: qml