Skip to content

Commit

Permalink
Remove tests with deprecated QubitStateVector (#163)
Browse files Browse the repository at this point in the history
* fix import path

* remove usage of `QubitStateVector` in tests
  • Loading branch information
astralcai authored Sep 19, 2024
1 parent fbf15ff commit 9753059
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ def test_apply_basis_state_raises_an_error_if_not_first(self):
):
dev.apply(queue)

@pytest.mark.parametrize("op", [qml.StatePrep, qml.QubitStateVector])
def test_apply_statesvector_raises_an_error_if_not_first(self, op):
"""Test that there is an error raised when the QubitStateVector or StatePrep op is not
def test_apply_statesvector_raises_an_error_if_not_first(self):
"""Test that there is an error raised when the StatePrep op is not
applied as the first operation."""
wires = 1
dev = RigettiDevice(wires=wires, shots=1)

operation = op(np.array([1, 0]), wires=list(range(wires)))
operation = qml.StatePrep(np.array([1, 0]), wires=list(range(wires)))
queue = [qml.PauliX(0), operation]
with pytest.raises(
qml.DeviceError,
Expand Down
7 changes: 3 additions & 4 deletions tests/test_qvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,12 @@ def test_parametric_compilation_with_numeric_and_symbolic_queue(
assert len(dev._compiled_program_dict.items()) == 1
assert mock_qvm.compile.call_count == 1

@pytest.mark.parametrize("op", [qml.QubitStateVector, qml.StatePrep])
def test_apply_qubitstatesvector_raises_an_error_if_not_first(self, op):
"""Test that there is an error raised when the QubitStateVector or StatPrep is not
def test_apply_qubitstatesvector_raises_an_error_if_not_first(self):
"""Test that there is an error raised when the StatPrep is not
applied as the first operation."""
dev = qml.device("rigetti.qvm", device="2q-qvm", parametric_compilation=True)

operation = op(np.array([1, 0]), wires=[0])
operation = qml.StatePrep(np.array([1, 0]), wires=[0])
queue = [qml.PauliX(0), operation]
with pytest.raises(
qml.DeviceError,
Expand Down

0 comments on commit 9753059

Please sign in to comment.