From f65873d1e06d84dc9d1c74d090e8dda6546daea9 Mon Sep 17 00:00:00 2001 From: Alec Edgington <54802828+cqc-alec@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:44:41 +0100 Subject: [PATCH] Fix test for maximum number of classical registers. (#518) --- tests/integration/backend_test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/integration/backend_test.py b/tests/integration/backend_test.py index 6bea04ce..a2dedcf5 100644 --- a/tests/integration/backend_test.py +++ b/tests/integration/backend_test.py @@ -122,19 +122,23 @@ def test_max_classical_register( ) -> None: backend = authenticated_quum_backend_qa + info = backend.backend_info + assert info is not None + n_cl_reg = info.n_cl_reg + assert isinstance(n_cl_reg, int) + c = Circuit(4, 4, "test 1") c.H(0) c.CX(0, 1) c.measure_all() c = backend.get_compiled_circuit(c) assert backend._check_all_circuits([c]) - for i in range(0, 20): + for i in range(n_cl_reg - 1): c.add_c_register(f"creg-{i}", 32) assert backend._check_all_circuits([c]) - for i in range(20, 200): - c.add_c_register(f"creg-{i}", 32) + c.add_c_register("creg-extra", 32) with pytest.raises(CircuitNotValidError): backend._check_all_circuits([c])