Skip to content

Commit

Permalink
store tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Oct 30, 2024
1 parent ac175d8 commit 633e0d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def test_handle_air_gap_in_place_request_not_ready_to_aspirate(

with pytest.raises(
PipetteNotReadyToAspirateError,
match="Pipette cannot aspirate in place because of a previous blow out."
match="Pipette cannot air gap in place because of a previous blow out."
" The first aspirate following a blow-out must be from a specific well"
" so the plunger can be reset in a known safe position.",
):
Expand Down
13 changes: 13 additions & 0 deletions api/tests/opentrons/protocol_engine/state/test_pipette_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def test_handles_load_pipette(
mount=MountType.LEFT,
)
assert result.aspirated_volume_by_id["pipette-id"] is None
assert result.aspirated_liquid_by_id["pipette-id"] is None
assert result.movement_speed_by_id["pipette-id"] is None
assert result.attached_tip_by_id["pipette-id"] is None

Expand Down Expand Up @@ -291,6 +292,7 @@ def test_handles_pick_up_and_drop_tip(subject: PipetteStore) -> None:
volume=42, length=101, diameter=8.0
)
assert subject.state.aspirated_volume_by_id["abc"] == 0
assert subject.state.aspirated_liquid_by_id["abc"] == 0

subject.handle_action(
SucceedCommandAction(
Expand All @@ -304,6 +306,7 @@ def test_handles_pick_up_and_drop_tip(subject: PipetteStore) -> None:
)
assert subject.state.attached_tip_by_id["abc"] is None
assert subject.state.aspirated_volume_by_id["abc"] is None
assert subject.state.aspirated_liquid_by_id["abc"] is None


def test_handles_drop_tip_in_place(subject: PipetteStore) -> None:
Expand Down Expand Up @@ -350,6 +353,7 @@ def test_handles_drop_tip_in_place(subject: PipetteStore) -> None:
volume=42, length=101, diameter=8.0
)
assert subject.state.aspirated_volume_by_id["xyz"] == 0
assert subject.state.aspirated_liquid_by_id["xyz"] == 0

subject.handle_action(
SucceedCommandAction(
Expand All @@ -363,6 +367,7 @@ def test_handles_drop_tip_in_place(subject: PipetteStore) -> None:
)
assert subject.state.attached_tip_by_id["xyz"] is None
assert subject.state.aspirated_volume_by_id["xyz"] is None
assert subject.state.aspirated_liquid_by_id["xyz"] is None


def test_handles_unsafe_drop_tip_in_place(subject: PipetteStore) -> None:
Expand Down Expand Up @@ -409,6 +414,7 @@ def test_handles_unsafe_drop_tip_in_place(subject: PipetteStore) -> None:
volume=42, length=101, diameter=8.0
)
assert subject.state.aspirated_volume_by_id["xyz"] == 0
assert subject.state.aspirated_liquid_by_id["xyz"] == 0

subject.handle_action(
SucceedCommandAction(
Expand All @@ -422,6 +428,7 @@ def test_handles_unsafe_drop_tip_in_place(subject: PipetteStore) -> None:
)
assert subject.state.attached_tip_by_id["xyz"] is None
assert subject.state.aspirated_volume_by_id["xyz"] is None
assert subject.state.aspirated_liquid_by_id["xyz"] is None


@pytest.mark.parametrize(
Expand Down Expand Up @@ -459,10 +466,12 @@ def test_aspirate_adds_volume(
subject.handle_action(SucceedCommandAction(command=aspirate_command))

assert subject.state.aspirated_volume_by_id["pipette-id"] == 42
assert subject.state.aspirated_liquid_by_id["pipette-id"] == 42

subject.handle_action(SucceedCommandAction(command=aspirate_command))

assert subject.state.aspirated_volume_by_id["pipette-id"] == 84
assert subject.state.aspirated_liquid_by_id["pipette-id"] == 84


@pytest.mark.parametrize(
Expand Down Expand Up @@ -508,10 +517,12 @@ def test_dispense_subtracts_volume(
subject.handle_action(SucceedCommandAction(command=dispense_command))

assert subject.state.aspirated_volume_by_id["pipette-id"] == 21
assert subject.state.aspirated_liquid_by_id["pipette-id"] == 21

subject.handle_action(SucceedCommandAction(command=dispense_command))

assert subject.state.aspirated_volume_by_id["pipette-id"] == 0
assert subject.state.aspirated_liquid_by_id["pipette-id"] == 0


@pytest.mark.parametrize(
Expand Down Expand Up @@ -554,6 +565,7 @@ def test_blow_out_clears_volume(
subject.handle_action(SucceedCommandAction(command=blow_out_command))

assert subject.state.aspirated_volume_by_id["pipette-id"] is None
assert subject.state.aspirated_liquid_by_id["pipette-id"] is None


def test_set_movement_speed(subject: PipetteStore) -> None:
Expand Down Expand Up @@ -700,3 +712,4 @@ def test_prepare_to_aspirate_marks_pipette_ready(
)
subject.handle_action(SucceedCommandAction(command=prepare_to_aspirate_command))
assert subject.state.aspirated_volume_by_id["pipette-id"] == 0.0
assert subject.state.aspirated_liquid_by_id["pipette-id"] == 0.0

0 comments on commit 633e0d0

Please sign in to comment.