Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pylabrobot/resources/tip_rack.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def __init__(

super().__init__(
name,
size_x=size_y,
size_y=size_x,
size_x=size_x,
size_y=size_y,
size_z=size_z,
category=category,
metadata=metadata,
Expand Down
29 changes: 29 additions & 0 deletions pylabrobot/resources/tip_rack_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,32 @@ def test_set_tip_state_fills_with_named_tips(self):
spot = rack.get_item("A1")
tip = spot.tracker.get_tip()
self.assertIsNotNone(tip.name)


class TipSpotSizeTests(unittest.TestCase):
"""Tests that a tip spot keeps the footprint it was created with."""

@staticmethod
def _make_tip(name: str) -> Tip:
return Tip(
name=name,
has_filter=False,
total_tip_length=50.0,
maximal_volume=300.0,
fitting_depth=8.0,
)

def test_size_x_and_size_y_are_not_transposed(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we really need this now that is fixed? :)

spot = TipSpot(name="spot", size_x=8.0, size_y=5.0, size_z=2.0, make_tip=self._make_tip)

self.assertEqual(spot.get_size_x(), 8.0)
self.assertEqual(spot.get_size_y(), 5.0)
self.assertEqual(spot.center(), Coordinate(4.0, 2.5, 0.0))

def test_serialization_round_trip_preserves_footprint(self):
spot = TipSpot(name="spot", size_x=8.0, size_y=5.0, size_z=2.0, make_tip=self._make_tip)

round_tripped = TipSpot.deserialize(spot.serialize())

self.assertEqual(round_tripped.get_size_x(), spot.get_size_x())
self.assertEqual(round_tripped.get_size_y(), spot.get_size_y())
Loading