Skip to content

Commit

Permalink
fix: fix test names
Browse files Browse the repository at this point in the history
  • Loading branch information
mstechly committed Nov 21, 2024
1 parent 63bedb9 commit 26f2db8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/compilation/test_repetitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,15 @@ def test_repetition_serializes_to_qref(repetition_dict):
compilation_result.to_qref()


def test_raises_exception_when_invalid_resource_types():
routine = _routine_with_repetition({"count": 5, "sequence": {"type": "constant"}})
other_resource = ResourceV1(name="other_resource", type="other", value=5)
routine.program.children[0].resources.append(other_resource)

with pytest.raises(BartiqCompilationError):
_ = compile_routine(routine)


@pytest.fixture
def set_repetition_env():
old_env = os.getenv("BARTIQ_REPETITION_ALLOW_ARBITRARY_RESOURCES")
Expand All @@ -321,8 +330,7 @@ def set_repetition_env():


@pytest.mark.usefixtures("set_repetition_env")
@pytest.mark.parametrize("allow_arbitrary_resources", (False, True))
def test_handles_invalid_resource_types(allow_arbitrary_resources):
def test_raises_warning_when_invalid_resource_types_and_env_set():
routine = _routine_with_repetition({"count": 5, "sequence": {"type": "constant"}})
other_resource = ResourceV1(name="other_resource", type="other", value=5)
routine.program.children[0].resources.append(other_resource)
Expand All @@ -331,12 +339,3 @@ def test_handles_invalid_resource_types(allow_arbitrary_resources):
compiled_routine = compile_routine(routine).routine
assert compiled_routine.resources["other_resource"].value == 5
assert compiled_routine.resources["other_resource"].type == "other"


def test_handles_invalid_resource_types():
routine = _routine_with_repetition({"count": 5, "sequence": {"type": "constant"}})
other_resource = ResourceV1(name="other_resource", type="other", value=5)
routine.program.children[0].resources.append(other_resource)

with pytest.raises(BartiqCompilationError):
_ = compile_routine(routine)

0 comments on commit 26f2db8

Please sign in to comment.