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

Fix random seed of unit tests #2151

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions test/terra/backends/test_parameterized_qobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def test_run_path_with_more_params_than_expressions(self):
circuit.ry(phi, 1)
circuit.measure_all()
parameter_binds = [{theta: [0, pi, 2 * pi], phi: [0, 1, pi]}]
res = backend.run(circuit, shots=shots, parameter_binds=parameter_binds).result()
res = backend.run(
circuit, shots=shots, parameter_binds=parameter_binds, **self.BACKEND_OPTS
).result()
counts = res.get_counts()
for index, expected in enumerate(
[{"00": shots}, {"01": 0.25 * shots, "11": 0.75 * shots}, {"10": shots}]
Expand Down Expand Up @@ -317,7 +319,9 @@ def test_run_path_with_more_params_than_expressions_multiple_circuits(self):
circuit.ry(phi, 1)
circuit.measure_all()
parameter_binds = [{theta: [0, pi, 2 * pi], phi: [0, 1, pi]}] * 3
res = backend.run([circuit] * 3, shots=shots, parameter_binds=parameter_binds).result()
res = backend.run(
[circuit] * 3, shots=shots, parameter_binds=parameter_binds, **self.BACKEND_OPTS
).result()
counts = res.get_counts()
for index, expected in enumerate(
[{"00": shots}, {"01": 0.25 * shots, "11": 0.75 * shots}, {"10": shots}] * 3
Expand Down
3 changes: 2 additions & 1 deletion test/terra/states/test_aer_densitymatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ def test_QFT(self):

def test_two_qubit_QV(self):
"""Test single qubit QuantumVolume"""
state = AerDensityMatrix(QuantumVolume(2))
state = AerDensityMatrix(QuantumVolume(2, seed=1111))
state.seed(1111)
counts = state.sample_counts(shots=1024)
self.assertEqual(4, len(counts))
self.assertTrue("00" in counts)
Expand Down
Loading