From 3d2cae0714ce919a64de70ca9954263a01ba8c14 Mon Sep 17 00:00:00 2001 From: Yaiza Date: Mon, 15 Jul 2024 10:32:05 +0200 Subject: [PATCH] Adds error msg test when body is malformed --- tests/test_transpiler_service.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_transpiler_service.py b/tests/test_transpiler_service.py index 1b50b07..bc838e5 100644 --- a/tests/test_transpiler_service.py +++ b/tests/test_transpiler_service.py @@ -184,7 +184,6 @@ def test_transpile_wrong_backend(backend_name): def test_transpile_exceed_circuit_size(): - circuit = EfficientSU2(100, entanglement="circular", reps=50).decompose() transpiler_service = TranspilerService( backend_name="ibm_kyoto", @@ -202,6 +201,25 @@ def test_transpile_exceed_circuit_size(): ) +def test_transpile_malformed_body(): + circuit = EfficientSU2(100, entanglement="circular", reps=1).decompose() + transpiler_service = TranspilerService( + backend_name="ibm_kyoto", + ai="false", + optimization_level=3, + qiskit_transpile_options={ "failing_option": 0 } + ) + + try: + transpiler_service.run(circuit) + pytest.fail("Error expected") + except Exception as e: + assert ( + str(e) + == '"transpile() got an unexpected keyword argument \'failing_option\'"' + ) + + def compare_layouts(plugin_circ, non_ai_circ): assert ( plugin_circ.layout.initial_layout == non_ai_circ.layout.initial_layout