class_docstr: Tests for purity transform
docstr: Tests gradient of the purity for a qnode
docstr_tok: ["Tests","gradient","of","the","purity","for","a","qnode"]
code: def test_IsingXX_qnode_purity_grad(
      self, device, param, wires, is_partial, diff_method
  ):
      """Tests gradient of the purity for a qnode"""
  
      dev = qml.device(device, wires=2)
  
      @qml.qnode(dev, diff_method=diff_method)
      def circuit_state(x):
          qml.IsingXX(x, wires=[0, 1])
          return qml.state()
  
      grad_purity = qml.grad(
          qml.qinfo.purity(circuit_state, wires=wires)
      )(param)
      expected_grad = (
          expected_purity_grad_ising_xx(param) if is_partial else 0
      )
      assert qml.math.allclose(grad_purity, expected_grad)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 6 for calling the TestPurity obj's underlying member method code with example usage: obj.test_IsingXX_qnode_purity_grad(device, param, wires, is_partial, diff_method) and returns: qml