Skip to content

Commit

Permalink
Fix coverage, remove dup test
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencap committed Oct 28, 2023
1 parent e90fd53 commit 0f1f1a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
5 changes: 2 additions & 3 deletions src/braket/experimental/autoqasm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,8 @@ def _get_gate_args(f: Callable) -> aq_program.GateArgs:

if param.annotation == aq_instructions.QubitIdentifierType:
gate_args.append_qubit(param.name)
elif param.annotation in [float, aq_types.FloatVar] or (
get_args(param.annotation)
and any(type_ in [float, aq_types.FloatVar] for type_ in get_args(param.annotation))
elif param.annotation == float or any(
type_ == float for type_ in get_args(param.annotation)
):
gate_args.append_angle(param.name)
else:
Expand Down
23 changes: 0 additions & 23 deletions test/unit_tests/braket/experimental/autoqasm/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,6 @@ def test_multiple_parameters():
assert multi_parametric().to_ir() == expected


def test_typed_parameters():
"""Test that multiple free parameters all appear in the processed program."""

@aq.main
def multi_parametric():
rx(0, FreeParameter("alpha"))
rx(1, FreeParameter("theta"))
c = measure([0, 1]) # noqa: F841

expected = """OPENQASM 3.0;
bit[2] c;
input float[64] alpha;
input float[64] theta;
qubit[2] __qubits__;
rx(alpha) __qubits__[0];
rx(theta) __qubits__[1];
bit[2] __bit_0__ = "00";
__bit_0__[0] = measure __qubits__[0];
__bit_0__[1] = measure __qubits__[1];
c = __bit_0__;"""
assert multi_parametric().to_ir() == expected


def test_sim_multi_param():
measurements = _test_parametric_on_local_sim(multi_parametric(), {"alpha": 3.14, "theta": 0})
assert all(val == "10" for val in measurements["c"])
Expand Down

0 comments on commit 0f1f1a2

Please sign in to comment.