class_docstr: Test that the device declares its capabilities correctly.
class_docstr_tok: ["Test","that","the","device","declares","its","capabilities","correctly","."]
docstr: Test that the capabilities dictionary defines a valid model.
docstr_tok: ["Test","that","the","capabilities","dictionary","defines","a","valid","model","."]
code: def test_model_is_defined_valid_and_correct(self, device_kwargs):
      """Test that the capabilities dictionary defines a valid model."""
      device_kwargs["wires"] = 1
      dev = qml.device(**device_kwargs)
      cap = dev.capabilities()
      assert "model" in cap
      assert cap["model"] in ["qubit", "cv"]
  
      if cap["model"] == "qubit":
  
          @qml.qnode(dev)
          def circuit():
              qml.PauliX(wires=0)
              return qml.expval(qml.PauliZ(wires=0))
  
      else:
  
          @qml.qnode(dev)
          def circuit():
              qml.Displacement(1.0, 1.2345, wires=0)
              return qml.expval(qml.QuadX(wires=0))
  
      # assert that device can measure observable from its model
      circuit()
  
file_path: pennylane/pennylane/devices/tests/test_properties.py
imports: import pytest
  import pennylane.numpy
  import pennylane
  from pennylane._device import DeviceError
label_desc: Use image node_id 2 for calling the TestCapabilities obj's underlying member method code with example usage: obj.test_model_is_defined_valid_and_correct(device_kwargs) and returns: qml, qml