Skip to content

Allow waste_vol and cleaner_vol to be float or int (bug fix) #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions robotools/evotools/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,11 @@ def prepare_evo_wash_parameters(
Tuple with grid position (1-67) and site number (1-128) of cleaner as integers
arm : int
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
waste_vol: float
waste_vol: float, int
Volume in waste in mL (0-100)
waste_delay : int
Delay before closing valves in waste in ms (0-1000)
cleaner_vol: float
cleaner_vol: float, int
Volume in cleaner in mL (0-100)
cleaner_delay : int
Delay before closing valves in cleaner in ms (0-1000)
Expand All @@ -423,11 +423,11 @@ def prepare_evo_wash_parameters(
Tuple with grid position (1-67) and site number (0-127) of cleaner as integers
arm : int
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
waste_vol: float
waste_vol: float, int
Volume in waste in mL (0-100)
waste_delay : int
Delay before closing valves in waste in ms (0-1000)
cleaner_vol: float
cleaner_vol: float, int
Volume in cleaner in mL (0-100)
cleaner_delay : int
Delay before closing valves in cleaner in ms (0-1000)
Expand Down Expand Up @@ -477,8 +477,8 @@ def prepare_evo_wash_parameters(

if waste_vol is None:
raise ValueError("Missing required parameter: waste_vol")
if not isinstance(waste_vol, float) or not 0 <= waste_vol <= 100:
raise ValueError("waste_vol has to be a float from 0 - 100.")
if not isinstance(waste_vol, (float, int)) or not 0 <= waste_vol <= 100:
raise ValueError("waste_vol has to be a float or int from 0 - 100.")
# round waste_vol to the first decimal (pre-requisite for Tecan's wash command)
waste_vol = np.round(waste_vol, 1)

Expand All @@ -489,8 +489,8 @@ def prepare_evo_wash_parameters(

if cleaner_vol is None:
raise ValueError("Missing required parameter: cleaner_vol")
if not isinstance(cleaner_vol, float) or not 0 <= cleaner_vol <= 100:
raise ValueError("cleaner_vol has to be a float from 0 - 100.")
if not isinstance(cleaner_vol, (float, int)) or not 0 <= cleaner_vol <= 100:
raise ValueError("cleaner_vol has to be a float or int from 0 - 100.")
# round cleaner_vol to the first decimal (pre-requisite for Tecan's wash command)
cleaner_vol = np.round(cleaner_vol, 1)

Expand Down Expand Up @@ -575,11 +575,11 @@ def evo_wash(
Tuple with grid position (1-67) and site number (1-128) of cleaner as integers
arm : int
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
waste_vol: float
waste_vol: float, int
Volume in waste in mL (0-100)
waste_delay : int
Delay before closing valves in waste in ms (0-1000)
cleaner_vol: float
cleaner_vol: float, int
Volume in cleaner in mL (0-100)
cleaner_delay : int
Delay before closing valves in cleaner in ms (0-1000)
Expand Down
34 changes: 16 additions & 18 deletions robotools/evotools/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,27 +321,26 @@ def test_prepare_evo_wash_parameters_checking(self):
)

# test waste_vol argument check
with pytest.raises(ValueError, match="waste_vol has to be a float"):
with pytest.raises(ValueError, match="waste_vol .*? float or int from 0 - 100."):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
waste_vol=-1.0,
)
with pytest.raises(ValueError, match="waste_vol has to be a float"):
with pytest.raises(ValueError, match="waste_vol .*? float or int from 0 - 100."):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
waste_vol=101.0,
)
with pytest.raises(ValueError, match="waste_vol has to be a float"):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
waste_vol=1,
)
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
waste_vol=1,
)

# test waste_delay argument check
with pytest.raises(ValueError, match="waste_delay has to be an int"):
Expand All @@ -367,27 +366,26 @@ def test_prepare_evo_wash_parameters_checking(self):
)

# test cleaner_vol argument check
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
with pytest.raises(ValueError, match="cleaner_vol .*? float or int from 0 - 100."):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
cleaner_vol=-1.0,
)
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
with pytest.raises(ValueError, match="cleaner_vol .*? float or int from 0 - 100."):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
cleaner_vol=101.0,
)
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
cleaner_vol=1,
)
prepare_evo_wash_parameters(
tips=[1, 2],
waste_location=(52, 2),
cleaner_location=(52, 1),
cleaner_vol=1,
)

# test cleaner_delay argument check
with pytest.raises(ValueError, match="cleaner_delay has to be an int"):
Expand Down
Loading