diff --git a/test/library/randomized_benchmarking/test_standard_rb.py b/test/library/randomized_benchmarking/test_standard_rb.py index bafd28a12c..5a920547e2 100644 --- a/test/library/randomized_benchmarking/test_standard_rb.py +++ b/test/library/randomized_benchmarking/test_standard_rb.py @@ -12,11 +12,13 @@ """Test for randomized benchmarking experiments.""" import copy +import io from test.base import QiskitExperimentsTestCase from test.library.randomized_benchmarking.mixin import RBTestMixin from ddt import ddt, data, unpack +from qiskit import qpy from qiskit.circuit.library import SXGate from qiskit.exceptions import QiskitError from qiskit.providers.fake_provider import FakeManilaV2 @@ -60,6 +62,17 @@ def test_roundtrip_serializable(self): exp = rb.StandardRB(physical_qubits=(0,), lengths=[10, 20, 30], seed=123) self.assertRoundTripSerializable(exp) + def test_circuit_serialization(self): + """Test round trip qpy serialization""" + exp = rb.StandardRB(physical_qubits=(0,), lengths=[10, 20, 30], seed=123) + circs = exp.circuits() + qpy_file = io.BytesIO() + qpy.dump(circs, qpy_file) + qpy_file.seek(0) + new_circs = qpy.load(qpy_file) + + self.assertEqual(circs, new_circs) + def test_analysis_config(self): """ "Test converting analysis to and from config works""" analysis = rb.RBAnalysis()