From 34e5821e947d57e0c08b05b507da337b0c5a66ef Mon Sep 17 00:00:00 2001 From: Takashi Imamichi Date: Wed, 29 May 2024 17:00:21 +0900 Subject: [PATCH] fix random seed --- test/terra/backends/test_parameterized_qobj.py | 8 ++++++-- test/terra/states/test_aer_densitymatrix.py | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/terra/backends/test_parameterized_qobj.py b/test/terra/backends/test_parameterized_qobj.py index 2c046449b2..b37f2d981e 100644 --- a/test/terra/backends/test_parameterized_qobj.py +++ b/test/terra/backends/test_parameterized_qobj.py @@ -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}] @@ -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 diff --git a/test/terra/states/test_aer_densitymatrix.py b/test/terra/states/test_aer_densitymatrix.py index 55a1a26a86..683a9856ed 100644 --- a/test/terra/states/test_aer_densitymatrix.py +++ b/test/terra/states/test_aer_densitymatrix.py @@ -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)