def test_module_load(): module_names = ['tempdeck', 'magdeck'] module_defs = json.loads(load_shared_data('module/definitions/1.json')) for name in module_names: mod = labware.load_module(name, Location(Point(0, 0, 0), 'test')) mod_def = module_defs[name] offset = Point(mod_def['labwareOffset']['x'], mod_def['labwareOffset']['y'], mod_def['labwareOffset']['z']) high_z = mod_def['dimensions']['bareOverallHeight'] assert mod.highest_z == high_z assert mod.location.point == offset mod = labware.load_module(name, Location(Point(1, 2, 3), 'test')) assert mod.highest_z == high_z + 3 assert mod.location.point == (offset + Point(1, 2, 3)) mod2 = labware.load_module_from_definition( mod_def, Location(Point(3, 2, 1), 'test2')) assert mod2.highest_z == high_z + 1 assert mod2.location.point == (offset + Point(3, 2, 1))
def test_highest_z(): deck = Deck() assert deck.highest_z == 0 lw = labware.load(labware_name, deck.position_for(1)) deck[1] = lw assert deck.highest_z == pytest.approx(lw.wells()[0].top().point.z) del deck[1] assert deck.highest_z == 0 mod = labware.load_module('tempdeck', deck.position_for(8)) deck[8] = mod assert deck.highest_z == mod.highest_z lw = labware.load(labware_name, mod.location) mod.add_labware(lw) deck.recalculate_high_z() assert deck.highest_z == mod.highest_z
def test_module_load_labware(): module_names = ['tempdeck', 'magdeck'] labware_name = 'corning_96_wellplate_360ul_flat' labware_def = labware.get_labware_definition(labware_name) for name in module_names: mod = labware.load_module(name, Location(Point(0, 0, 0), 'test')) old_z = mod.highest_z lw = labware.load_from_definition(labware_def, mod.location) mod.add_labware(lw) assert mod.labware == lw assert mod.highest_z ==\ (mod.location.point.z + labware_def['dimensions']['zDimension'] + mod._over_labware) with pytest.raises(AssertionError): mod.add_labware(lw) mod.reset_labware() assert mod.labware is None assert mod.highest_z == old_z
def test_slot_collisions(): d = Deck() mod_slot = '7' mod = labware.load_module('thermocycler', d.position_for(mod_slot)) d[mod_slot] = mod with pytest.raises(ValueError): d['7'] = 'not this time boyo' with pytest.raises(ValueError): d['8'] = 'nor this time boyo' with pytest.raises(ValueError): d['10'] = 'or even this time boyo' with pytest.raises(ValueError): d['11'] = 'def not this time though' lw_slot = '4' lw = labware.load(labware_name, d.position_for(lw_slot)) d[lw_slot] = lw assert lw_slot in d
def test_slot_names(): slots_by_int = list(range(1, 13)) slots_by_str = [str(idx) for idx in slots_by_int] for method in (slots_by_int, slots_by_str): d = Deck() for idx, slot in enumerate(method): lw = labware.load(labware_name, d.position_for(slot)) assert slot in d d[slot] = lw with pytest.raises(ValueError): d[slot] = 'not this time boyo' del d[slot] assert slot in d assert d[slot] is None mod = labware.load_module('tempdeck', d.position_for(slot)) d[slot] = mod assert mod == d[slot] assert 'hasasdaia' not in d with pytest.raises(ValueError): d['ahgoasia'] = 'nope'