def test_add_instrument(local_test_pipette, robot):
    trash, tiprack1, tiprack2, plate, p200 = local_test_pipette
    robot.reset()
    Pipette(robot, ul_per_mm=18.5, max_volume=1000, mount='left')
    with pytest.raises(RuntimeError):
        Pipette(robot,
                mount='left',
                max_volume=100,
                ul_per_mm=10)
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
def test_deprecated_axis_call(local_test_pipette, robot):
    trash, tiprack1, tiprack2, plate, p200 = local_test_pipette
    import warnings

    warnings.filterwarnings('error')
    # Check that user warning occurs when axis is called
    with pytest.raises(UserWarning):
        Pipette(robot, axis='a')

    # Check that the warning is still valid when max_volume is also used
    with pytest.raises(UserWarning):
        Pipette(robot, axis='a', max_volume=300)

    warnings.filterwarnings('default')
def test_get_instruments_by_name(local_test_pipette, robot):
    trash, tiprack1, tiprack2, plate, p200 = local_test_pipette
    p1000 = Pipette(
        robot,
        ul_per_mm=18.5,
        trash_container=trash,
        tip_racks=[tiprack1],
        max_volume=1000,
        min_volume=10,  # These are variable
        mount='right',
        name='p1000',
        channels=1,
        aspirate_speed=300,
        dispense_speed=500)
    result = list(robot.get_instruments('p1000'))
    assert result == [('right', p1000)]
def local_test_pipette(robot):
    trash = containers_load(robot, 'point', '1')
    tiprack1 = containers_load(robot, 'tiprack-10ul', '5')
    tiprack2 = containers_load(robot, 'tiprack-10ul', '8')

    plate = containers_load(robot, '96-flat', '4')

    p200 = Pipette(
        robot,
        ul_per_mm=18.5,
        trash_container=trash,
        tip_racks=[tiprack1, tiprack2],
        max_volume=200,
        min_volume=10,  # These are variable
        mount='left',
        channels=1,
        name='other-pipette-for-transfer-tests')

    p200.reset()

    p200.calibrate_plunger(top=0, bottom=10, blow_out=12, drop_tip=13)
    robot.home()
    return trash, tiprack1, tiprack2, plate, p200
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 __new__(cls, config: TopConfigurationContext,
             existingInstance: Pipette):
     assert isinstance(existingInstance, Pipette)
     existingInstance.__class__ = EnhancedPipetteV1
     return existingInstance
Exemple #8
0
def test_integration(robot):
    left = Pipette(robot, mount='left', ul_per_mm=1000, max_volume=1000)
    robot.home()
    pose = left._move(robot.poses, 1, 1, 1)
    assert isclose(change_base(pose, src=left), (1, 1, 1)).all()