From f9b9b50e40f3f21647ff455c1357a3156c54ee08 Mon Sep 17 00:00:00 2001 From: Ryan Woo Date: Thu, 19 Sep 2024 09:22:07 -0400 Subject: [PATCH 1/3] Add open_pulse to the backend_configuration.to_dict() --- qiskit_aer/backends/backendconfiguration.py | 1 + .../backends/test_backend_configuration.py | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/terra/backends/test_backend_configuration.py diff --git a/qiskit_aer/backends/backendconfiguration.py b/qiskit_aer/backends/backendconfiguration.py index e32ab378d3..ba0981ae52 100644 --- a/qiskit_aer/backends/backendconfiguration.py +++ b/qiskit_aer/backends/backendconfiguration.py @@ -325,6 +325,7 @@ def to_dict(self): "max_shots": self.max_shots, "coupling_map": self.coupling_map, "dynamic_reprate_enabled": self.dynamic_reprate_enabled, + "open_pulse": self.open_pulse, } if hasattr(self, "supported_instructions"): diff --git a/test/terra/backends/test_backend_configuration.py b/test/terra/backends/test_backend_configuration.py new file mode 100644 index 0000000000..72668ce893 --- /dev/null +++ b/test/terra/backends/test_backend_configuration.py @@ -0,0 +1,30 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2024. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. +""" +Tests for Aer BackendConfiguration +""" + +from test.terra.common import QiskitAerTestCase + +from ddt import data, ddt +from qiskit_aer.backends import AerSimulator, QasmSimulator, StatevectorSimulator, UnitarySimulator + + +@ddt +class TestBackendConfiguration(QiskitAerTestCase): + """Tests for Aer BackendConfiguration.""" + + @data(AerSimulator(), StatevectorSimulator(), QasmSimulator(), UnitarySimulator()) + def test_oepn_pulse_in_backend_configuration(self, simulator: str): + """Test for backend_configuration""" + assert simulator.configuration().open_pulse is False + assert simulator.configuration().to_dict()["open_pulse"] is False From 5945f92222739e855017614f8d9e2b8dde1e5517 Mon Sep 17 00:00:00 2001 From: ryan-woo Date: Fri, 20 Sep 2024 09:59:53 -0400 Subject: [PATCH 2/3] Update test/terra/backends/test_backend_configuration.py Co-authored-by: Samuele Ferracin --- test/terra/backends/test_backend_configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/terra/backends/test_backend_configuration.py b/test/terra/backends/test_backend_configuration.py index 72668ce893..4196c9c7b7 100644 --- a/test/terra/backends/test_backend_configuration.py +++ b/test/terra/backends/test_backend_configuration.py @@ -24,7 +24,7 @@ class TestBackendConfiguration(QiskitAerTestCase): """Tests for Aer BackendConfiguration.""" @data(AerSimulator(), StatevectorSimulator(), QasmSimulator(), UnitarySimulator()) - def test_oepn_pulse_in_backend_configuration(self, simulator: str): + def test_open_pulse_in_backend_configuration(self, simulator: str): """Test for backend_configuration""" assert simulator.configuration().open_pulse is False assert simulator.configuration().to_dict()["open_pulse"] is False From 42ed14ef10ad6e67afe5b1591f81fc61f98b9738 Mon Sep 17 00:00:00 2001 From: ryan-woo Date: Fri, 20 Sep 2024 10:00:31 -0400 Subject: [PATCH 3/3] Update test_backend_configuration.py --- test/terra/backends/test_backend_configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/terra/backends/test_backend_configuration.py b/test/terra/backends/test_backend_configuration.py index 4196c9c7b7..4b1d2f50be 100644 --- a/test/terra/backends/test_backend_configuration.py +++ b/test/terra/backends/test_backend_configuration.py @@ -25,6 +25,6 @@ class TestBackendConfiguration(QiskitAerTestCase): @data(AerSimulator(), StatevectorSimulator(), QasmSimulator(), UnitarySimulator()) def test_open_pulse_in_backend_configuration(self, simulator: str): - """Test for backend_configuration""" + """Test that open_pulse is part of backend_configuration""" assert simulator.configuration().open_pulse is False assert simulator.configuration().to_dict()["open_pulse"] is False