Skip to content

Commit

Permalink
store tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Oct 29, 2024
1 parent ccacaac commit 3b1a4de
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 @@ -250,6 +250,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 @@ -301,6 +302,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 @@ -315,6 +317,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 @@ -363,6 +366,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 @@ -377,6 +381,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 @@ -425,6 +430,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 @@ -439,6 +445,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 @@ -479,12 +486,14 @@ def test_aspirate_adds_volume(
)

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

subject.handle_action(
SucceedCommandAction(private_result=None, 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 @@ -535,12 +544,14 @@ def test_dispense_subtracts_volume(
)

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

subject.handle_action(
SucceedCommandAction(private_result=None, 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 @@ -588,6 +599,7 @@ def test_blow_out_clears_volume(
)

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 @@ -745,3 +757,4 @@ def test_prepare_to_aspirate_marks_pipette_ready(
SucceedCommandAction(private_result=None, 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 3b1a4de

Please sign in to comment.