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_grad(
      self, param, wires, is_partial, diff_method
  ):
      """Tests purity for a qnode"""
  
      dev = qml.device("default.qubit.legacy", wires=2)
  
      @qml.qnode(dev, diff_method=diff_method)
      def circuit(x):
          qml.IsingXX(x, wires=[0, 1])
          return qml.purity(wires=wires)
  
      grad_purity = qml.grad(circuit)(param)
      expected_grad = (
          expected_purity_grad_ising_xx(param) if is_partial else 0
      )
      assert qml.math.allclose(
          grad_purity, expected_grad, rtol=1e-04, atol=1e-05
      )
  
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 2 for calling the TestPurityIntegration obj's underlying member method code with example usage: obj.test_IsingXX_qnode_purity_grad(param, wires, is_partial, diff_method) and returns: qml