Skip to content

Commit

Permalink
removed redundant module_id from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed Dec 16, 2024
1 parent ba68978 commit c476b6b
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions api/tests/opentrons/protocol_engine/state/test_update_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
def test_append() -> None:
"""Test `StateUpdate.append()`."""
state_update = update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=True
)
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(is_lid_on=True)
)

# Populating a new field should leave the original ones unchanged.
Expand All @@ -18,21 +16,21 @@ def test_append() -> None:
)
assert result is state_update
assert state_update.absorbance_reader_lid == update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=True
is_lid_on=True
)
assert state_update.pipette_location == update_types.CLEAR

# Populating a field that's already been populated should overwrite it.
result = state_update.append(
update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=False
is_lid_on=False
)
)
)
assert result is state_update
assert state_update.absorbance_reader_lid == update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=False
is_lid_on=False
)
assert state_update.pipette_location == update_types.CLEAR

Expand All @@ -44,32 +42,24 @@ def test_reduce() -> None:
# It should union all the set fields together.
assert update_types.StateUpdate.reduce(
update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=True
)
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(is_lid_on=True)
),
update_types.StateUpdate(pipette_location=update_types.CLEAR),
) == update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=True
),
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(is_lid_on=True),
pipette_location=update_types.CLEAR,
)

# When one field appears multiple times, the last write wins.
assert update_types.StateUpdate.reduce(
update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=True
)
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(is_lid_on=True)
),
update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=False
is_lid_on=False
)
),
) == update_types.StateUpdate(
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(
module_id="module_id", is_lid_on=False
)
absorbance_reader_lid=update_types.AbsorbanceReaderLidUpdate(is_lid_on=False)
)

0 comments on commit c476b6b

Please sign in to comment.