Skip to content

Commit 3a109d5

Browse files
authored
fix(api): preserve meniscus relative through move() (#18374)
When we call location.move(), we need to preserve a meniscus origin if we have one. Closes RABR-774
1 parent 0c7eec0 commit 3a109d5

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

api/src/opentrons/types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ def move(self, point: Point) -> "Location":
199199
200200
"""
201201

202-
return Location(point=self.point + point, labware=self._given_labware)
202+
return Location(
203+
point=self.point + point,
204+
labware=self._given_labware,
205+
_meniscus_tracking=self._meniscus_tracking,
206+
)
203207

204208
def __repr__(self) -> str:
205209
return f"Location(point={repr(self._point)}, labware={self._labware}, meniscus_tracking={self._meniscus_tracking})"

api/tests/opentrons/test_types.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from opentrons.types import DeckSlotName, Point, Location
2+
from opentrons.types import DeckSlotName, Point, Location, MeniscusTrackingTarget
33
from opentrons.protocol_api.labware import Labware
44

55

@@ -91,3 +91,18 @@ def test_deck_slot_name_equivalencies(
9191
)
9292
def test_deck_slot_name_as_int(input: DeckSlotName, expected_int: int) -> None:
9393
assert input.as_int() == expected_int
94+
95+
96+
def test_location_move_preseves_meniscus() -> None:
97+
"""Location.move() should preserve meniscus relativeness."""
98+
loc = Location(
99+
point=Point(x=1, y=2, z=3),
100+
labware=None,
101+
_meniscus_tracking=MeniscusTrackingTarget.START,
102+
)
103+
moved = loc.move(Point(x=1, y=2, z=3))
104+
assert moved == Location(
105+
point=Point(x=2, y=4, z=6),
106+
labware=None,
107+
_meniscus_tracking=MeniscusTrackingTarget.START,
108+
)

0 commit comments

Comments
 (0)