Skip to content

Commit

Permalink
add tests for new util function
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed May 28, 2024
1 parent ac7a6a2 commit ef08704
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions api/tests/opentrons/hardware_control/backends/test_ot3_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest
from typing import List
from opentrons_hardware.hardware_control.motion_planning import Move
from opentrons_hardware.hardware_control.motion import (
create_step,
Expand Down Expand Up @@ -119,3 +121,48 @@ def test_get_system_contraints_for_plunger() -> None:
)

assert updated_contraints[axis].max_acceleration == set_acceleration


@pytest.mark.parametrize(
["moving", "expected"],
[
[
[NodeId.gantry_x, NodeId.gantry_y, NodeId.gripper_g, NodeId.gripper_z],
[],
],
[
[NodeId.head_l],
[NodeId.pipette_left],
],
[
[NodeId.head_r],
[NodeId.pipette_right],
],
],
)
def test_moving_pipettes_in_move_group(
moving: List[NodeId], expected: List[NodeId]
) -> None:
"""Test that we can filter out the nonmoving nodes."""
present_nodes = [
NodeId.gantry_x,
NodeId.gantry_y,
NodeId.head_l,
NodeId.head_r,
NodeId.pipette_left,
NodeId.pipette_right,
NodeId.gripper_g,
NodeId.gripper_z,
]
move_group = [
create_step(
distance={node: f64(100) for node in moving},
velocity={node: f64(100) for node in moving},
acceleration={node: f64(0) for node in moving},
duration=f64(1),
present_nodes=present_nodes,
)
]

moving_pipettes = ot3utils.moving_pipettes_in_move_group(move_group)
assert set(moving_pipettes) == set(expected)

0 comments on commit ef08704

Please sign in to comment.