Skip to content

Commit

Permalink
fix vt remove_liquid
Browse files Browse the repository at this point in the history
  • Loading branch information
rickwierenga committed Nov 2, 2023
1 parent fd3e777 commit e0c735a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pylabrobot/resources/volume_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def remove_liquid(self, volume: float) -> None:

removed_volume = 0.0
while removed_volume < volume:
liquid, volume = self.liquids.pop()
removed_volume += volume
liquid, liquid_volume = self.liquids.pop()
removed_volume += liquid_volume

# If we have more liquid than we need, put the excess back.
if removed_volume > volume:
Expand Down
5 changes: 4 additions & 1 deletion pylabrobot/resources/volume_tracker_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def test_add_liquid(self):
def test_remove_liquid(self):
tracker = VolumeTracker(max_volume=100)
tracker.add_liquid(liquid=None, volume=60)
tracker.commit()

self.assertEqual(tracker.get_used_volume(), 60)
self.assertEqual(tracker.get_free_volume(), 40)
tracker.remove_liquid(volume=20)
self.assertEqual(tracker.get_used_volume(), 40)

with self.assertRaises(TooLittleLiquidError):
tracker.remove_liquid(volume=100)

0 comments on commit e0c735a

Please sign in to comment.