Пример #1
0
def test_get_labware(labware_setup):
    instruments, tip_racks, plates, commands = labware_setup
    p100, p1000 = instruments

    assert _get_labware(commands[0]) == \
        ([p100], [plates[0]], [], [(p100, plates[0])])

    assert _get_labware(commands[1]) == \
        ([], [plates[1]], [], [])

    assert _get_labware(commands[2]) == \
        ([p1000],
         [plates[0], plates[1]],
         [],
         [(p1000, plates[0]), (p1000, plates[1])])

    instruments, containers, modules, interactions = \
        _accumulate([_get_labware(command) for command in commands])

    assert \
        [
            list(_dedupe(instruments)),
            list(_dedupe(containers)),
            list(_dedupe(modules)),
            list(_dedupe(interactions))
        ] == \
        [
            [p100, p1000],
            [plates[0], plates[1]],
            [],
            [(p100, plates[0]), (p1000, plates[0]), (p1000, plates[1])]
        ]
Пример #2
0
def test_get_instruments_and_containers(labware_setup, virtual_smoothie_env):
    instruments, tip_racks, plates, commands = labware_setup
    p100, p1000 = instruments

    instruments, containers, modules, interactions = \
        _accumulate([_get_labware(command) for command in commands])

    session = Session(name='', text='')
    # We are calling dedupe directly for testing purposes.
    # Normally it is called from within a session
    session._instruments.extend(_dedupe(instruments))
    session._containers.extend(_dedupe(containers))
    session._modules.extend(_dedupe(modules))
    session._interactions.extend(_dedupe(interactions))

    instruments = session.get_instruments()
    containers = session.get_containers()
    modules = session.get_modules()

    assert [i.name for i in instruments] == ['p100', 'p1000']
    assert [i.axis for i in instruments] == ['a', 'b']
    assert [i.id for i in instruments] == [id(p100), id(p1000)]
    assert [[t.slot for t in i.tip_racks] for i in instruments] == \
        [['1', '4'], ['1', '4']]
    assert [[c.slot for c in i.containers] for i in instruments] == \
        [['2'], ['2', '5']]

    assert [c.slot for c in containers] == ['2', '5']
    assert [[i.id for i in c.instruments] for c in containers] == \
        [[id(p100), id(p1000)], [id(p1000)]]
    assert [c.id for c in containers] == [id(plates[0]), id(plates[1])]

    # TODO(ben 20180717): Add meaningful data and assertions for modules once
    # TODO                the API object is in place
    assert modules == []