Skip to content

Commit

Permalink
Fix test params
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentmr committed Apr 18, 2024
1 parent b10c6fb commit a0c6265
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_preprocess_grover_operator_decomposition(self, wires):
class TestAngleEmbedding:
"""Test the AngleEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_angleembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -104,14 +104,13 @@ class TestAmplitudeEmbedding:
"""Test the AmplitudeEmbedding algorithm."""

@pytest.mark.parametrize("first_op", [False, True])
@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 10, 2))
def test_amplitudeembedding(self, first_op, n_qubits):
if not first_op:
if device_name == "lightning.qubit":
pytest.xfail(f"{device_name} too slow.")
pytest.xfail(
f"Operation StatePrep cannot be used after other Operations have already been applied on a {device_name} device."
)
if device_name != "lightning.qubit":
pytest.xfail(
f"Operation StatePrep cannot be used after other Operations have already been applied on a {device_name} device."
)

dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -133,7 +132,7 @@ def circuit(f=None):
class TestBasisEmbedding:
"""Test the BasisEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_basisembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -153,7 +152,7 @@ def circuit(feature_vector):
class TestDisplacementSqueezingEmbedding:
"""Test the DisplacementEmbedding and SqueezingEmbedding algorithms."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
@pytest.mark.parametrize("template", [qml.DisplacementEmbedding, qml.SqueezingEmbedding])
def test_displacementembedding(self, n_qubits, template):
dev = qml.device(device_name, wires=n_qubits)
Expand All @@ -172,7 +171,7 @@ def circuit(feature_vector):
class TestIQPEmbedding:
"""Test the IQPEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_iqpembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -192,7 +191,7 @@ def circuit(feature_vector):
class TestQAOAEmbedding:
"""Test the QAOAEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qaoaembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -232,7 +231,7 @@ def circuit(weights):
class TestRandomLayers:
"""Test the RandomLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_randomlayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit", wires=n_qubits)
Expand All @@ -252,7 +251,7 @@ def circuit(weights):
class TestStronglyEntanglingLayers:
"""Test the StronglyEntanglingLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_stronglyentanglinglayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -273,7 +272,7 @@ def circuit(weights):
class TestSimplifiedTwoDesign:
"""Test the SimplifiedTwoDesign algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_simplifiedtwodesign(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -296,7 +295,7 @@ def circuit(init_weights, weights):
class TestBasicEntanglerLayers:
"""Test the BasicEntanglerLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_basicentanglerlayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -612,7 +611,7 @@ def circuit(params):
class TestApproxTimeEvolution:
"""Test the ApproxTimeEvolution algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_approxtimeevolution(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -634,7 +633,7 @@ def circuit(time):
class TestQDrift:
"""Test the QDrift algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qdrift(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit", wires=n_qubits)
Expand All @@ -656,7 +655,7 @@ def circuit(time):
class TestTrotterProduct:
"""Test the TrotterProduct algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_trotterproduct(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -678,7 +677,7 @@ def circuit(time):
class TestQuantumPhaseEstimation:
"""Test the QuantumPhaseEstimation algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 12, 2))
def test_quantumphaseestimation(self, n_qubits):
phase = 5
target_wires = [0]
Expand Down Expand Up @@ -710,7 +709,7 @@ def circuit():
class TestQFT:
"""Test the QFT algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qft(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -769,7 +768,7 @@ def circuit(basis_state):
class TestQSVT:
"""Test the QSVT algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qsvt(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down

0 comments on commit a0c6265

Please sign in to comment.