class_docstr: Tests for integration with the PassthruQNode
class_docstr_tok: ["Tests","for","integration","with","the","PassthruQNode"]
docstr: Test that the device state can be differentiated
docstr_tok: ["Test","that","the","device","state","can","be","differentiated"]
code: def test_state_differentiability(
      self, wires, op, wire_ids, exp_fn, tol
  ):
      """Test that the device state can be differentiated"""
      # pylint: disable=too-many-arguments
      dev = qml.device("default.mixed", wires=wires)
  
      @qml.qnode(dev, diff_method="backprop", interface="torch")
      def circuit(a):
          qml.PauliX(wires[wire_ids[0]])
          op(a, wires=[wires[idx] for idx in wire_ids])
          return qml.state()
  
      a = torch.tensor(0.54, dtype=torch.float64, requires_grad=True)
  
      state = circuit(a)
      res = torch.abs(state) ** 2
      res = res[1][1] - res[0][0]
      res.backward()
  
      expected = torch.tensor(exp_fn(a), dtype=torch.float64)
      assert torch.allclose(a.grad, expected, atol=tol, rtol=0)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane import numpy
  from pennylane.devices.default_mixed import DefaultMixed
label_desc: Use image node_id 4 for calling the TestPassthruIntegration obj's underlying member method code with example usage: obj.test_state_differentiability(wires, op, wire_ids, exp_fn, tol) and returns: qml