Skip to content

Commit

Permalink
Fix up tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed Dec 14, 2023
1 parent 1f131d5 commit 4f0845e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions api/tests/opentrons/protocol_api/test_protocol_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,17 @@ def test_load_instrument_replace(
"""It should allow/disallow pipette replacement."""
mock_instrument_core = decoy.mock(cls=InstrumentCore)

decoy.when(mock_validation.ensure_lowercase_name("ada")).then_return("ada")
decoy.when(
mock_validation.ensure_mount_for_pipette("ada", matchers.IsA(Mount))
).then_return(Mount.RIGHT)
decoy.when(mock_validation.ensure_lowercase_name(matchers.IsA(str))).then_return(
"ada"
)
decoy.when(mock_validation.ensure_pipette_name(matchers.IsA(str))).then_return(
PipetteNameType.P300_SINGLE
)
decoy.when(
mock_validation.ensure_mount_for_pipette(
matchers.IsA(Mount), matchers.IsA(PipetteNameType)
)
).then_return(Mount.RIGHT)
decoy.when(
mock_core.load_instrument(
instrument_name=matchers.IsA(PipetteNameType),
Expand Down Expand Up @@ -239,12 +243,16 @@ def test_96_channel_pipette_raises_if_another_pipette_attached(
"""It should always raise when loading a 96-channel pipette when another pipette is attached."""
mock_instrument_core = decoy.mock(cls=InstrumentCore)

decoy.when(mock_validation.ensure_lowercase_name("ada")).then_return("ada")
decoy.when(mock_validation.ensure_pipette_name("ada")).then_return(
PipetteNameType.P300_SINGLE
)
decoy.when(
mock_validation.ensure_mount_for_pipette("ada", matchers.IsA(Mount))
mock_validation.ensure_lowercase_name("A Single Channel Name")
).then_return("a single channel name")
decoy.when(
mock_validation.ensure_pipette_name("a single channel name")
).then_return(PipetteNameType.P300_SINGLE)
decoy.when(
mock_validation.ensure_mount_for_pipette(
Mount.RIGHT, PipetteNameType.P300_SINGLE
)
).then_return(Mount.RIGHT)

decoy.when(
Expand All @@ -260,7 +268,9 @@ def test_96_channel_pipette_raises_if_another_pipette_attached(
NoTrashDefinedError("No trash!")
)

pipette_1 = subject.load_instrument(instrument_name="ada", mount=Mount.RIGHT)
pipette_1 = subject.load_instrument(
instrument_name="A Single Channel Name", mount=Mount.RIGHT
)
assert subject.loaded_instruments["right"] is pipette_1

decoy.when(mock_validation.ensure_lowercase_name("A 96 Channel Name")).then_return(
Expand All @@ -270,7 +280,7 @@ def test_96_channel_pipette_raises_if_another_pipette_attached(
PipetteNameType.P1000_96
)
decoy.when(
mock_validation.ensure_mount_for_pipette("shadowfax", matchers.IsA(Mount))
mock_validation.ensure_mount_for_pipette("shadowfax", PipetteNameType.P1000_96)
).then_return(Mount.LEFT)
decoy.when(
mock_core.load_instrument(
Expand Down

0 comments on commit 4f0845e

Please sign in to comment.