From 1765f3c5f72bddf856d312556d3432469fffc835 Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Tue, 26 Mar 2024 15:06:27 +0100 Subject: [PATCH] Deprecate `Labware.positions` This lookup dictionary encoded a well numbering scheme which differs between Tecan EVO and Tecan Fluent liquid handlers. Users should use these functions instead: * `evotools.get_well_position` * `fluenttools.get_well_position` --- robotools/liquidhandling/labware.py | 6 +++ robotools/liquidhandling/test_labware.py | 62 ++++++++++++------------ 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/robotools/liquidhandling/labware.py b/robotools/liquidhandling/labware.py index d7ddcc5..cffbd37 100644 --- a/robotools/liquidhandling/labware.py +++ b/robotools/liquidhandling/labware.py @@ -54,6 +54,12 @@ def indices(self) -> Dict[str, Tuple[int, int]]: @property def positions(self) -> Dict[str, int]: """Mapping of well-ids to EVOware-compatible position numbers.""" + warnings.warn( + "`Labware.positions` is deprecated in favor of model-specific implementations." + "Use `robotools.evotools.get_well_positions()` or `robotools.fluenttools.get_well_positions()`.", + DeprecationWarning, + stacklevel=2, + ) return self._positions @property diff --git a/robotools/liquidhandling/test_labware.py b/robotools/liquidhandling/test_labware.py index b7e6961..ab6ab60 100644 --- a/robotools/liquidhandling/test_labware.py +++ b/robotools/liquidhandling/test_labware.py @@ -32,14 +32,15 @@ def test_init(self) -> None: "B03": (1, 2), } assert plate.indices == exp - assert plate.positions == { - "A01": 1, - "A02": 3, - "A03": 5, - "B01": 2, - "B02": 4, - "B03": 6, - } + with pytest.warns(DeprecationWarning, match="in favor of model-specific"): + assert plate.positions == { + "A01": 1, + "A02": 3, + "A03": 5, + "B01": 2, + "B02": 4, + "B03": 6, + } return def test_invalid_init(self) -> None: @@ -215,28 +216,29 @@ def test_init_trough(self) -> None: "E03": (0, 2), "E04": (0, 3), } - assert trough.positions == { - "A01": 1, - "A02": 6, - "A03": 11, - "A04": 16, - "B01": 2, - "B02": 7, - "B03": 12, - "B04": 17, - "C01": 3, - "C02": 8, - "C03": 13, - "C04": 18, - "D01": 4, - "D02": 9, - "D03": 14, - "D04": 19, - "E01": 5, - "E02": 10, - "E03": 15, - "E04": 20, - } + with pytest.warns(DeprecationWarning, match="in favor of model-specific"): + assert trough.positions == { + "A01": 1, + "A02": 6, + "A03": 11, + "A04": 16, + "B01": 2, + "B02": 7, + "B03": 12, + "B04": 17, + "C01": 3, + "C02": 8, + "C03": 13, + "C04": 18, + "D01": 4, + "D02": 9, + "D03": 14, + "D04": 19, + "E01": 5, + "E02": 10, + "E03": 15, + "E04": 20, + } return def test_initial_volumes(self) -> None: