Skip to content

Commit 659ec40

Browse files
authored
feat(step-generation): prepare_to_aspirate py generation (#17797)
closes AUTH-1583
1 parent bb564c6 commit 659ec40

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, it, expect } from 'vitest'
22
import {
3+
DEFAULT_PIPETTE,
34
getInitialRobotStateStandard,
45
getSuccessResult,
56
makeContext,
@@ -8,7 +9,6 @@ import { airGapInTrash } from '../commandCreators/compound'
89
import type { CutoutId } from '@opentrons/shared-data'
910
import type { InvariantContext, RobotState } from '../types'
1011

11-
const mockId = 'mockId'
1212
const mockCutout: CutoutId = 'cutoutA3'
1313
const invariantContext: InvariantContext = makeContext()
1414
const prevRobotState: RobotState = getInitialRobotStateStandard(
@@ -19,7 +19,7 @@ describe('airGapInTrash', () => {
1919
it('returns correct commands for airGapInPlace over a trash bin', () => {
2020
const result = airGapInTrash(
2121
{
22-
pipetteId: mockId,
22+
pipetteId: DEFAULT_PIPETTE,
2323
volume: 10,
2424
flowRate: 10,
2525
trashLocation: mockCutout,
@@ -32,7 +32,7 @@ describe('airGapInTrash', () => {
3232
commandType: 'moveToAddressableArea',
3333
key: expect.any(String),
3434
params: {
35-
pipetteId: mockId,
35+
pipetteId: DEFAULT_PIPETTE,
3636
addressableAreaName: 'movableTrashA3',
3737
offset: { x: 0, y: 0, z: 0 },
3838
},
@@ -41,14 +41,14 @@ describe('airGapInTrash', () => {
4141
commandType: 'prepareToAspirate',
4242
key: expect.any(String),
4343
params: {
44-
pipetteId: mockId,
44+
pipetteId: DEFAULT_PIPETTE,
4545
},
4646
},
4747
{
4848
commandType: 'airGapInPlace',
4949
key: expect.any(String),
5050
params: {
51-
pipetteId: mockId,
51+
pipetteId: DEFAULT_PIPETTE,
5252
volume: 10,
5353
flowRate: 10,
5454
},

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
makeContext,
44
getRobotStateWithTipStandard,
55
getSuccessResult,
6+
DEFAULT_PIPETTE,
67
} from '../fixtures'
78
import { prepareToAspirate } from '../commandCreators/atomic'
89
import type { PrepareToAspirateParams } from '@opentrons/shared-data'
@@ -12,14 +13,13 @@ describe('prepareToAspirate', () => {
1213
let invariantContext: InvariantContext
1314
let robotStateWithTip: RobotState
1415

15-
const mockId = 'mockId'
1616
beforeEach(() => {
1717
invariantContext = makeContext()
1818
robotStateWithTip = getRobotStateWithTipStandard(invariantContext)
1919
})
2020
it('aspirate in place', () => {
2121
const params: PrepareToAspirateParams = {
22-
pipetteId: mockId,
22+
pipetteId: DEFAULT_PIPETTE,
2323
}
2424
const result = prepareToAspirate(
2525
params,
@@ -32,9 +32,10 @@ describe('prepareToAspirate', () => {
3232
commandType: 'prepareToAspirate',
3333
key: expect.any(String),
3434
params: {
35-
pipetteId: mockId,
35+
pipetteId: DEFAULT_PIPETTE,
3636
},
3737
},
3838
])
39+
expect(res.python).toBe('mockPythonName.prepare_to_aspirate()')
3940
})
4041
})

step-generation/src/commandCreators/atomic/prepareToAspirate.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ import { uuid } from '../../utils'
22
import type { CommandCreator } from '../../types'
33
import type { PrepareToAspirateParams } from '@opentrons/shared-data'
44

5-
export const prepareToAspirate: CommandCreator<PrepareToAspirateParams> = args => {
5+
export const prepareToAspirate: CommandCreator<PrepareToAspirateParams> = (
6+
args,
7+
invariantContext,
8+
prevRobotState
9+
) => {
610
const { pipetteId } = args
11+
const pipettePythonName =
12+
invariantContext.pipetteEntities[pipetteId].pythonName
713

814
const commands = [
915
{
@@ -16,5 +22,6 @@ export const prepareToAspirate: CommandCreator<PrepareToAspirateParams> = args =
1622
]
1723
return {
1824
commands,
25+
python: `${pipettePythonName}.prepare_to_aspirate()`,
1926
}
2027
}

0 commit comments

Comments
 (0)