Skip to content

Commit edeff3a

Browse files
committed
fix test seed
1 parent d0d7215 commit edeff3a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_backends_clifford.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ def test_random_clifford_circuit(backend, prob_qubits, binary):
165165
backend.assert_allclose(np_count / nshots, clif_count / nshots, atol=1e-1)
166166

167167

168-
def test_collapsing_measurements(backend):
168+
@pytest.mark.parametrize("seed", [2024])
169+
def test_collapsing_measurements(backend, seed):
169170
clifford_bkd = construct_clifford_backend(backend)
170171
gate_queue = random_clifford(3, density_matrix=True, backend=backend).queue
171172
measured_qubits = np.random.choice(range(3), size=2, replace=False)
@@ -180,8 +181,13 @@ def test_collapsing_measurements(backend):
180181
c2.add(g)
181182
c1.add(gates.M(*range(3)))
182183
c2.add(gates.M(*range(3)))
183-
clifford_res = clifford_bkd.execute_circuit(c1, nshots=1000)
184-
numpy_res = numpy_bkd.execute_circuit(c2, nshots=1000)
184+
185+
clifford_bkd.set_seed(seed)
186+
clifford_res = clifford_bkd.execute_circuit(c1, nshots=100)
187+
188+
numpy_bkd.set_seed(seed)
189+
numpy_res = numpy_bkd.execute_circuit(c2, nshots=100)
190+
185191
backend.assert_allclose(
186192
clifford_res.probabilities(), backend.cast(numpy_res.probabilities()), atol=1e-1
187193
)

0 commit comments

Comments
 (0)