Beispiel #1
0
    def test_apply_basisstate_not_first_exception(self):
        """Tests that the apply method raises an exception when BasisState
        is not the first operation."""

        dev = AQTDevice(3, api_key=SOME_API_KEY)

        with pytest.raises(qml.DeviceError, match="only supported at the beginning of a circuit"):
            dev.apply([qml.RX(0.5, wires=1), qml.BasisState(np.array([1, 1, 1]), wires=[0, 1, 2])])
Beispiel #2
0
    def test_apply_qubitstatevector_not_first_exception(self):
        """Tests that the apply method raises an exception when QubitStateVector
        is not the first operation."""

        dev = AQTDevice(2, api_key=SOME_API_KEY)

        state = np.ones(8) / np.sqrt(8)
        with pytest.raises(qml.DeviceError, match="only supported at the beginning of a circuit"):
            dev.apply([qml.RX(0.5, wires=1), qml.QubitStateVector(state, wires=[0, 1, 2])])