From 5c3abf9c11365f347da8bfc1ca60434cb5920462 Mon Sep 17 00:00:00 2001 From: Lauren Capelluto <107005333+laurencap@users.noreply.github.com> Date: Fri, 23 Jun 2023 11:10:03 -0400 Subject: [PATCH] Increase program test coverage (#287) --- .../braket/experimental/autoqasm/test_program.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/unit_tests/braket/experimental/autoqasm/test_program.py b/test/unit_tests/braket/experimental/autoqasm/test_program.py index 949afc8f9..16a552ea3 100644 --- a/test/unit_tests/braket/experimental/autoqasm/test_program.py +++ b/test/unit_tests/braket/experimental/autoqasm/test_program.py @@ -17,6 +17,7 @@ import pytest import braket.experimental.autoqasm as aq +from braket.circuits.serialization import IRType def test_program_conversion_context() -> None: @@ -47,3 +48,15 @@ def test_build_program() -> None: with pytest.raises(AssertionError): aq.get_program_conversion_context() + + +def test_to_ir() -> None: + """Tests that an appropriate error is raised for unsupported ir_types.""" + with aq.build_program() as program_conversion_context: + aq.gates.h(0) + prog = program_conversion_context.make_program() + # No error for OpenQASM + prog.to_ir(IRType.OPENQASM) + + with pytest.raises(ValueError): + prog.to_ir(IRType.JAQCD)