def test_tip_tracking_chain(local_test_pipette, robot): trash, tiprack1, tiprack2, plate, p200 = local_test_pipette # TODO (ben 20171130): revise this test to make more sense in the # context of required tip pick_up/drop sequencing, etc. total_tips_per_plate = 4 tiprack1 = generate_plate( total_tips_per_plate, 2, (5, 5), (0, 0), 5) tiprack2 = generate_plate( total_tips_per_plate, 2, (5, 5), (0, 0), 5) robot._deck['1'].add(tiprack1, 'tiprack1') robot._deck['2'].add(tiprack2, 'tiprack2') p200 = Pipette( robot, mount='right', tip_racks=[tiprack1, tiprack2], trash_container=tiprack1, name='pipette-for-transfer-tests', max_volume=200, ul_per_mm=18.5 ) p200.move_to = mock.Mock() for _ in range(0, total_tips_per_plate * 2): p200.pick_up_tip() p200.tip_attached = False # prior expectation, for test only expected = [] for i in range(0, total_tips_per_plate): expected.extend(build_pick_up_tip(p200, tiprack1[i])) for i in range(0, total_tips_per_plate): expected.extend(build_pick_up_tip(p200, tiprack2[i])) assert p200.move_to.mock_calls == expected # test then when we go over the total number of tips, # Pipette raises a RuntimeWarning robot.clear_commands() p200.reset() for _ in range(0, total_tips_per_plate * 2): p200.pick_up_tip() p200.tip_attached = False # prior expectation, for test only with pytest.raises(RuntimeWarning): p200.pick_up_tip()
def test_tip_tracking_chain_multi_channel(local_test_pipette, robot): trash, tiprack1, tiprack2, plate, p200 = local_test_pipette # TODO (ben 20171130): revise this test to make more sense in the # context of required tip pick_up/drop sequencing, etc. p200_multi = Pipette( robot, trash_container=trash, tip_racks=[tiprack1, tiprack2], max_volume=200, min_volume=10, # These are variable mount='right', channels=8, ul_per_mm=18.5) p200_multi.calibrate_plunger(top=0, bottom=10, blow_out=12, drop_tip=13) p200_multi.move_to = mock.Mock() for _ in range(0, 12 * 2): p200_multi.pick_up_tip() p200_multi.tip_attached = False # prior expectation, for test only expected = [] for i in range(0, 12): expected.extend(build_pick_up_tip(p200_multi, tiprack1.cols[i])) for i in range(0, 12): expected.extend(build_pick_up_tip(p200_multi, tiprack2.cols[i])) assert p200_multi.move_to.mock_calls == expected