Skip to content

Commit c4aeade

Browse files
authored
fix(step-generation): transform changeTip arg to correct python string (#19023)
closes RQA-4445
1 parent ac7760b commit c4aeade

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

step-generation/src/__tests__/pythonFileUtils.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '@opentrons/shared-data'
2020

2121
import {
22+
formatChangeTipArg,
2223
getDefineLiquids,
2324
getLoadAdapters,
2425
getLoadLabware,
@@ -570,3 +571,15 @@ glycerol_50_base_class = protocol.get_liquid_class("glycerol_50")`.trimStart()
570571
)
571572
})
572573
})
574+
575+
describe('formatChangeTipArg', () => {
576+
it('should transform perSource into per source', () => {
577+
expect(formatChangeTipArg('perSource')).toBe('per source')
578+
})
579+
it('should transform perDest into per destination', () => {
580+
expect(formatChangeTipArg('perDest')).toBe('per destination')
581+
})
582+
it('should not alter never', () => {
583+
expect(formatChangeTipArg('never')).toBe('never')
584+
})
585+
})

step-generation/src/commandCreators/compound/consolidate.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
curryCommandCreator,
2323
curryWithoutPython,
2424
DEST_WELL_BLOWOUT_DESTINATION,
25+
formatChangeTipArg,
2526
formatPyStr,
2627
getIsRetractSafeForAirGap,
2728
getIsSafePipetteMovement,
@@ -373,9 +374,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
373374
`dest=${
374375
pythonDestWells != null ? `[${pythonDestWells}]` : destTrashPipetteName
375376
}`,
376-
// TODO: fix bug where new_tip api arg does not allow
377-
// changeTip: always but PD does
378-
`new_tip=${formatPyStr(changeTip)}`,
377+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
379378
`trash_location=${trashPipetteName}`,
380379
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
381380
`keep_last_tip=True`,

step-generation/src/commandCreators/compound/distribute.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
curryCommandCreator,
2424
curryWithoutPython,
2525
DEST_WELL_BLOWOUT_DESTINATION,
26+
formatChangeTipArg,
2627
formatPyStr,
2728
getIsRetractSafeForAirGap,
2829
getIsSafePipetteMovement,
@@ -405,9 +406,7 @@ export const distribute: CommandCreator<DistributeArgs> = (
405406
`volume=${volume}`,
406407
`source=[${pythonSourceWells}]`,
407408
`dest=[${pythonDestWells ?? destTrashPipetteName}]`,
408-
// TODO: fix bug where new_tip api arg does not allow
409-
// changeTip: always but PD does
410-
`new_tip=${formatPyStr(changeTip)}`,
409+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
411410
`trash_location=${trashPipetteName}`,
412411
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
413412
`keep_last_tip=True`,

step-generation/src/commandCreators/compound/transfer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
curryCommandCreator,
2020
curryWithoutPython,
2121
DEST_WELL_BLOWOUT_DESTINATION,
22+
formatChangeTipArg,
2223
formatPyStr,
2324
getIsRetractSafeForAirGap,
2425
getSlotInLocationStack,
@@ -376,7 +377,7 @@ export const transfer: CommandCreator<TransferArgs> = (
376377
`dest=${
377378
pythonDestWells != null ? `[${pythonDestWells}]` : destTrashPipetteName
378379
}`,
379-
`new_tip=${formatPyStr(changeTip)}`,
380+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
380381
`trash_location=${trashPipetteName}`,
381382
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
382383
`keep_last_tip=True`,

step-generation/src/utils/pythonFileUtils.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424

2525
import type { CutoutId, ProtocolFile, RobotType } from '@opentrons/shared-data'
2626
import type {
27+
ChangeTipOptions,
2728
InvariantContext,
2829
LabwareEntities,
2930
LabwareEntity,
@@ -511,3 +512,17 @@ export function pythonCustomLabwareDict(
511512
return ''
512513
}
513514
}
515+
516+
export const formatChangeTipArg = (changeTip: ChangeTipOptions): string => {
517+
switch (changeTip) {
518+
case 'perDest': {
519+
return 'per destination'
520+
}
521+
case 'perSource': {
522+
return 'per source'
523+
}
524+
default: {
525+
return changeTip
526+
}
527+
}
528+
}

0 commit comments

Comments
 (0)