class_docstr: Unit tests for validate_and_expand_adjoint
class_docstr_tok: ["Unit","tests","for","validate_and_expand_adjoint"]
docstr: Test that a circuit with finite shots executed with diff_method "adjoint"
  or "backprop" raises an error
docstr_tok: ["Test","that","a","circuit","with","finite","shots","executed","with","diff_method","``","adjoint","''","or","``","backprop","''","raises","an","error"]
code: def test_finite_shots_analytic_diff_method(self, diff_method):
      """Test that a circuit with finite shots executed with diff_method "adjoint"
      or "backprop" raises an error"""
      tape = qml.tape.QuantumScript(
          [], [qml.expval(qml.PauliZ(0))], shots=100
      )
  
      execution_config = ExecutionConfig(gradient_method=diff_method)
      program, _ = qml.device("default.qubit").preprocess(
          execution_config
      )
  
      msg = "Finite shots are not supported with"
      with pytest.raises(qml.DeviceError, match=msg):
          program((tape,))
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices import DefaultQubit, ExecutionConfig
  from pennylane.devices.default_qubit import stopping_condition
label_desc: Use image node_id 1 for calling the TestAdjointDiffTapeValidation obj's underlying member method code with example usage: obj.test_finite_shots_analytic_diff_method(diff_method) without return types