Skip to content

Commit b4d083b

Browse files
luisawachtendonkmichaelosthege
authored andcommitted
Allow waste_vol and cleaner_vol to be float or int (bug fix)
1 parent 758f175 commit b4d083b

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

robotools/evotools/commands.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ def prepare_evo_wash_parameters(
394394
Tuple with grid position (1-67) and site number (1-128) of cleaner as integers
395395
arm : int
396396
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
397-
waste_vol: float
397+
waste_vol: float, int
398398
Volume in waste in mL (0-100)
399399
waste_delay : int
400400
Delay before closing valves in waste in ms (0-1000)
401-
cleaner_vol: float
401+
cleaner_vol: float, int
402402
Volume in cleaner in mL (0-100)
403403
cleaner_delay : int
404404
Delay before closing valves in cleaner in ms (0-1000)
@@ -423,11 +423,11 @@ def prepare_evo_wash_parameters(
423423
Tuple with grid position (1-67) and site number (0-127) of cleaner as integers
424424
arm : int
425425
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
426-
waste_vol: float
426+
waste_vol: float, int
427427
Volume in waste in mL (0-100)
428428
waste_delay : int
429429
Delay before closing valves in waste in ms (0-1000)
430-
cleaner_vol: float
430+
cleaner_vol: float, int
431431
Volume in cleaner in mL (0-100)
432432
cleaner_delay : int
433433
Delay before closing valves in cleaner in ms (0-1000)
@@ -477,8 +477,8 @@ def prepare_evo_wash_parameters(
477477

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

@@ -489,8 +489,8 @@ def prepare_evo_wash_parameters(
489489

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

@@ -575,11 +575,11 @@ def evo_wash(
575575
Tuple with grid position (1-67) and site number (1-128) of cleaner as integers
576576
arm : int
577577
number of the LiHa performing the action: 0 = LiHa 1, 1 = LiHa 2
578-
waste_vol: float
578+
waste_vol: float, int
579579
Volume in waste in mL (0-100)
580580
waste_delay : int
581581
Delay before closing valves in waste in ms (0-1000)
582-
cleaner_vol: float
582+
cleaner_vol: float, int
583583
Volume in cleaner in mL (0-100)
584584
cleaner_delay : int
585585
Delay before closing valves in cleaner in ms (0-1000)

robotools/evotools/test_commands.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -321,27 +321,26 @@ def test_prepare_evo_wash_parameters_checking(self):
321321
)
322322

323323
# test waste_vol argument check
324-
with pytest.raises(ValueError, match="waste_vol has to be a float"):
324+
with pytest.raises(ValueError, match="waste_vol .*? float or int from 0 - 100."):
325325
prepare_evo_wash_parameters(
326326
tips=[1, 2],
327327
waste_location=(52, 2),
328328
cleaner_location=(52, 1),
329329
waste_vol=-1.0,
330330
)
331-
with pytest.raises(ValueError, match="waste_vol has to be a float"):
331+
with pytest.raises(ValueError, match="waste_vol .*? float or int from 0 - 100."):
332332
prepare_evo_wash_parameters(
333333
tips=[1, 2],
334334
waste_location=(52, 2),
335335
cleaner_location=(52, 1),
336336
waste_vol=101.0,
337337
)
338-
with pytest.raises(ValueError, match="waste_vol has to be a float"):
339-
prepare_evo_wash_parameters(
340-
tips=[1, 2],
341-
waste_location=(52, 2),
342-
cleaner_location=(52, 1),
343-
waste_vol=1,
344-
)
338+
prepare_evo_wash_parameters(
339+
tips=[1, 2],
340+
waste_location=(52, 2),
341+
cleaner_location=(52, 1),
342+
waste_vol=1,
343+
)
345344

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

369368
# test cleaner_vol argument check
370-
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
369+
with pytest.raises(ValueError, match="cleaner_vol .*? float or int from 0 - 100."):
371370
prepare_evo_wash_parameters(
372371
tips=[1, 2],
373372
waste_location=(52, 2),
374373
cleaner_location=(52, 1),
375374
cleaner_vol=-1.0,
376375
)
377-
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
376+
with pytest.raises(ValueError, match="cleaner_vol .*? float or int from 0 - 100."):
378377
prepare_evo_wash_parameters(
379378
tips=[1, 2],
380379
waste_location=(52, 2),
381380
cleaner_location=(52, 1),
382381
cleaner_vol=101.0,
383382
)
384-
with pytest.raises(ValueError, match="cleaner_vol has to be a float"):
385-
prepare_evo_wash_parameters(
386-
tips=[1, 2],
387-
waste_location=(52, 2),
388-
cleaner_location=(52, 1),
389-
cleaner_vol=1,
390-
)
383+
prepare_evo_wash_parameters(
384+
tips=[1, 2],
385+
waste_location=(52, 2),
386+
cleaner_location=(52, 1),
387+
cleaner_vol=1,
388+
)
391389

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

0 commit comments

Comments
 (0)