Skip to content

Commit

Permalink
Merge pull request #1145 from qiboteam/tests
Browse files Browse the repository at this point in the history
Reduction of runtime for some tests
  • Loading branch information
scarrazza authored Dec 21, 2023
2 parents 7e5dee4 + 2f89525 commit dbd4010
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/test_models_encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_unary_encoder(backend, nqubits):


@pytest.mark.parametrize("seed", [None, 10, np.random.default_rng(10)])
@pytest.mark.parametrize("nqubits", [8, 16])
@pytest.mark.parametrize("nqubits", [8])
def test_unary_encoder_random_gaussian(backend, nqubits, seed):
"""Tests if encoded vector are random variables sampled from
Gaussian distribution with 0.0 mean and variance close to the norm
Expand Down
8 changes: 4 additions & 4 deletions tests/test_quantum_info_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def test_entangling_capability(backend):
entangling_capability(circuit, samples, backend=backend)

nqubits = 2
samples = 500
samples = 100

c1 = Circuit(nqubits)
c1.add([gates.RX(q, 0, trainable=True) for q in range(nqubits)])
Expand Down Expand Up @@ -631,7 +631,7 @@ def test_expressibility(backend):
expressibility(circuit, t, samples, backend=backend)

nqubits = 2
samples = 500
samples = 100
t = 1

c1 = Circuit(nqubits)
Expand All @@ -652,9 +652,9 @@ def test_expressibility(backend):
backend.assert_allclose(expr_1 < expr_2 < expr_3, True)


@pytest.mark.parametrize("samples", [int(1e2)])
@pytest.mark.parametrize("samples", [int(1e1)])
@pytest.mark.parametrize("power_t", [2])
@pytest.mark.parametrize("nqubits", [2, 3, 4])
@pytest.mark.parametrize("nqubits", [2, 3])
def test_frame_potential(backend, nqubits, power_t, samples):
depth = int(np.ceil(nqubits * power_t))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_quantum_info_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_uniform_sampling_U3(backend, seed):
Y = backend.cast(matrices.Y, dtype=matrices.Y.dtype)
Z = backend.cast(matrices.Z, dtype=matrices.Z.dtype)

ngates = int(1e4)
ngates = int(1e3)
phases = uniform_sampling_U3(ngates, seed=seed, backend=backend)

# expectation values in the 3 directions should be the same
Expand Down
6 changes: 3 additions & 3 deletions tests/test_quantum_info_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ def test_haar_integral_errors(backend):
test = haar_integral(nqubits, power_t, samples=samples, backend=backend)


@pytest.mark.parametrize("power_t", [1, 2, 3])
@pytest.mark.parametrize("power_t", [1, 2])
@pytest.mark.parametrize("nqubits", [2, 3])
def test_haar_integral(backend, nqubits, power_t):
samples = int(1e4)
samples = int(1e3)

haar_int_exact = haar_integral(nqubits, power_t, samples=None, backend=backend)

haar_int_sampled = haar_integral(nqubits, power_t, samples=samples, backend=backend)

backend.assert_allclose(haar_int_sampled, haar_int_exact, atol=1e-2)
backend.assert_allclose(haar_int_sampled, haar_int_exact, atol=1e-1)


def test_pqc_integral(backend):
Expand Down

0 comments on commit dbd4010

Please sign in to comment.