Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tests of deprecated QubitStateVector #75

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions tests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,31 +163,27 @@ def test_basis_state_on_wires_subset(self, state, device_wires, op_wires, tol):
expected = dev._expand_state(expected, op_wires)
assert np.allclose(res, expected, tol)

@pytest.mark.parametrize("state_prep_op", (qml.QubitStateVector, qml.StatePrep))
def test_qubit_state_vector(self, init_state, state_prep_op, tol):
"""Test QubitStateVector and StatePrep application"""
def test_qubit_state_vector(self, init_state, tol):
"""Test StatePrep application"""
dev = QulacsDevice(1)
state = init_state(1)

op = state_prep_op(state, wires=[0])
op = qml.StatePrep(state, wires=[0])
dev.apply([op])
dev._obs_queue = []

res = dev.state
expected = state
assert np.allclose(res, expected, tol)

@pytest.mark.parametrize("state_prep_op", (qml.QubitStateVector, qml.StatePrep))
@pytest.mark.parametrize("device_wires", [3, 4, 5])
@pytest.mark.parametrize("op_wires", [[0], [2], [0, 1], [1, 0], [2, 0]])
def test_qubit_state_vector_on_wires_subset(
self, init_state, device_wires, op_wires, state_prep_op, tol
):
"""Test QubitStateVector and StatePrep application on a subset of device wires"""
def test_qubit_state_vector_on_wires_subset(self, init_state, device_wires, op_wires, tol):
"""Test StatePrep application on a subset of device wires"""
dev = QulacsDevice(device_wires)
state = init_state(len(op_wires))

op = state_prep_op(state, wires=op_wires)
op = qml.StatePrep(state, wires=op_wires)
dev.apply([op])
dev._obs_queue = []

Expand Down
Loading