Skip to content

Commit

Permalink
Update test_braket_device.py
Browse files Browse the repository at this point in the history
  • Loading branch information
speller26 committed Jan 16, 2025
1 parent 33734ee commit 5c0adb6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/unit_tests/test_braket_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,22 @@ def test_supported_ops_set(monkeypatch):
assert dev.operations == test_ops


def test_simplification():
"""Test that the Projector observable is correctly supported."""
wires = 5
dev = BraketLocalQubitDevice(wires=wires)

obs = qml.ops.LinearCombination([1.0, 2.0], [qml.X(0) @ qml.I(1), qml.Y(0) @ qml.X(1)])

@qml.qnode(dev)
def circuit(x):
qml.RX(x, 0)
return qml.expval(obs)

phi = np.array(1.5, requires_grad=True)
assert np.isclose(circuit(phi), 0)


def test_projection():
"""Test that the Projector observable is correctly supported."""
wires = 2
Expand Down

0 comments on commit 5c0adb6

Please sign in to comment.