Skip to content

Commit

Permalink
decoy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Dec 10, 2024
1 parent 88e008e commit 578984e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
5 changes: 3 additions & 2 deletions api/src/opentrons/protocol_engine/state/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ def get_well_height(
) -> float:
"""Get the height of a specified well for a labware."""
well_def = self._labware.get_well_definition(labware_id, well_name)
if labware_id == "axygen_1_reservoir_90ml":
breakpoint()
# if labware_id == "axygen_1_reservoir_90ml":
# breakpoint()
return well_def.depth

def _get_highest_z_from_labware_data(self, lw_data: LoadedLabware) -> float:
Expand Down Expand Up @@ -1530,6 +1530,7 @@ def get_well_volume_at_height(
) -> float:
"""Convert well height to volume."""
well_geometry = self._labware.get_well_geometry(labware_id, well_name)
# breakpoint()
return find_volume_at_well_height(
target_height=height, well_geometry=well_geometry
)
Expand Down
25 changes: 11 additions & 14 deletions api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from math import isclose
from typing import cast, List, Tuple, Optional, NamedTuple, Dict
from unittest.mock import sentinel
from os import listdir, path

import pytest
from decoy import Decoy
Expand All @@ -14,20 +15,20 @@
StateUpdate,
)

from opentrons_shared_data import get_shared_data_root, load_shared_data
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons_shared_data.deck import load as load_deck
from opentrons_shared_data.labware.types import LabwareUri
from opentrons_shared_data.pipette import pipette_definition
from opentrons.calibration_storage.helpers import uri_from_details
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocols.models import LabwareDefinition, WellDefinition
from opentrons.types import Point, DeckSlotName, MountType, StagingSlotName
from opentrons_shared_data.pipette.types import PipetteNameType
from opentrons_shared_data.labware.labware_definition import (
Dimensions as LabwareDimensions,
Parameters as LabwareDefinitionParameters,
CornerOffsetFromSlot,
)
from opentrons_shared_data import load_shared_data

from opentrons.protocol_engine import errors
from opentrons.protocol_engine.types import (
Expand Down Expand Up @@ -95,6 +96,7 @@
_volume_from_height_circular,
_volume_from_height_rectangular,
)
from .inner_geometry_test_params import INNER_WELL_GEOMETRY_TEST_PARAMS
from ..pipette_fixtures import get_default_nozzle_map
from ..mock_circular_frusta import TEST_EXAMPLES as CIRCULAR_TEST_EXAMPLES
from ..mock_rectangular_frusta import TEST_EXAMPLES as RECTANGULAR_TEST_EXAMPLES
Expand Down Expand Up @@ -3435,6 +3437,7 @@ def test_get_well_volume_at_height(
expected_volume_top: float,
input_height_from_bottom_mm: float,
input_height_from_top_mm: float,
mock_labware_view: LabwareView,
) -> None:
def _get_labware_def() -> LabwareDefinition:
def_dir = str(get_shared_data_root()) + f"/labware/definitions/3/{labware_id}"
Expand All @@ -3449,19 +3452,13 @@ def _get_labware_def() -> LabwareDefinition:
)
)
)
wells = _labware_def.wells
for id in wells:
breakpoint()
if wells[id]["geometryDefinitionId"] == well_name:
breakpoint()
depth = wells[id].depth
break
if labware_id == "axygen_1_reservoir_90ml":
breakpoint()
return _labware_def
well_geometry = _get_labware_def().innerLabwareGeometry.get(well_name)
decoy.when(subject._labware.get_well_geometry(labware_id, well_name)).then_return(well_geometry)
# decoy.when(subject._labware.get_well_height
labware_def = _get_labware_def()
well_geometry = labware_def.innerLabwareGeometry.get(well_name)
well_definition = [well for well in labware_def.wells.values() if well.geometryDefinitionId == well_name][0]

decoy.when(mock_labware_view.get_well_geometry(labware_id, well_name)).then_return(well_geometry)
decoy.when(mock_labware_view.get_well_definition(labware_id, well_name)).then_return(well_definition)

found_volume_bottom = subject.get_well_volume_at_height(
labware_id=labware_id,
Expand Down

0 comments on commit 578984e

Please sign in to comment.