class_docstr: Further unit tests for some new methods of QubitDevice.
class_docstr_tok: ["Further","unit","tests","for","some","new","methods","of","QubitDevice","."]
docstr: Check that an error is raised if the return type of an observable is unsupported
docstr_tok: ["Check","that","an","error","is","raised","if","the","return","type","of","an","observable","is","unsupported"]
code: def test_unsupported_observable_return_type_raise_error(self):
      """Check that an error is raised if the return type of an observable is unsupported"""
  
      # pylint: disable=too-few-public-methods
      class DummyMeasurement(MeasurementProcess):
          @property
          def return_type(self):
              return "SomeUnsupportedReturnType"
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.PauliX(wires=0)
          DummyMeasurement(obs=qml.PauliZ(0))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      dev = qml.device("default.qubit.legacy", wires=3)
      with pytest.raises(
          qml.QuantumFunctionError,
          match="Unsupported return type specified for observable",
      ):
          qml.execute(tapes=[tape], device=dev, gradient_fn=None)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementProcess
label_desc: Use image node_id 1 for calling the TestQubitDeviceNewUnits obj's underlying member method code with example usage: obj.test_unsupported_observable_return_type_raise_error() and returns: str