class_docstr: Tests for the state function
class_docstr_tok: ["Tests","for","the","state","function"]
docstr: Test that an exception is raised when a state is returned along with another return
  type
docstr_tok: ["Test","that","an","exception","is","raised","when","a","state","is","returned","along","with","another","return","type"]
code: def test_return_with_other_types(self):
      """Test that an exception is raised when a state is returned along with another return
      type"""
  
      dev = qml.device("default.qubit.legacy", wires=2)
  
      @qml.qnode(dev)
      def func():
          qml.Hadamard(wires=0)
          return state(), expval(qml.PauliZ(1))
  
      with pytest.raises(
          qml.QuantumFunctionError,
          match="The state or density matrix cannot be returned in combination with other return types",
      ):
          func()
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import State, Shots, density_matrix, expval, state
label_desc: Use image node_id 4 for calling the TestState obj's underlying member method code with example usage: obj.test_return_with_other_types() and returns: state,  expval