Skip to content

Commit

Permalink
Increase program test coverage (amazon-braket#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencap authored Jun 23, 2023
1 parent 7ab22e8 commit 5c3abf9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/unit_tests/braket/experimental/autoqasm/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import pytest

import braket.experimental.autoqasm as aq
from braket.circuits.serialization import IRType


def test_program_conversion_context() -> None:
Expand Down Expand Up @@ -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)

0 comments on commit 5c3abf9

Please sign in to comment.