def test_prepare_vessel_from_well(): try: import plateo from plateo.containers.plates import Plate96 except: return True else: plate = Plate96() mapping = { "ampicillin": "Amp", "plasmid_amp": "pAmpR", "ampr": "AmpR", "TOP10_strain": "TOP10", } components_quantities = { "ampicillin": 1, "plasmid_amp": 1, "ampr": 1, "TOP10_strain": 1, } plate.well_at_index(1).add_content(components_quantities, volume=1) vessel = plasma.prepare_vessel_from_well( plate.well_at_index(1), mapping=mapping ) assert len(vessel.strains) == 1 assert vessel.strains[0].name == "TOP10" assert vessel.env["plasmids"][0].name == "pAmpR" assert vessel.env["molecules"][0].name == "Amp"
def test_add_content(): plate = Plate96() well = plate.well_at_index(1) components_quantities = {"Compound_1": 5} volume = 20 * 10**(-6) # 20 uL well.add_content(components_quantities, volume=volume) assert well.content.quantities == {"Compound_1": 5}
def test___repr__(): assert Plate96().__repr__() == "Plate96(None)"
def test_iter_wells(): result = Plate96().iter_wells() assert isinstance(next(result), Well)
def test_index_to_wellname(index, direction, expected): assert Plate96().index_to_wellname(index, direction) == expected
def test_wellname_to_index(wellname, direction, expected): assert Plate96().wellname_to_index(wellname, direction) == expected
def test_get_well_at_index(): well = Plate96().well_at_index(5) assert well.name == "A5"
def test_wells_grouped_by(): assert len(Plate96().wells_grouped_by()[0][1]) == 96
def test_wells_satisfying(): def condition(well): return well.volume > 50 assert type(Plate96().wells_satisfying(condition)) == filter
def test_wells_in_row(): assert isinstance(Plate96().wells_in_row(5)[0], Well)
def test_wells_in_column(): assert isinstance(Plate96().wells_in_column(5)[0], Well)
def test_list_well_data_fields(): assert Plate96().list_well_data_fields() == []
def test_find_unique_well_containing(): with pytest.raises(Exception): Plate96().find_unique_well_containing("testquery")
def test_find_unique_well_by_condition(): with pytest.raises(Exception): Plate96().find_unique_well_by_condition(condition)
import pytest from plateo.containers.plates import Plate96 from plateo.Well import TransferError, Well plate = Plate96() well = plate.well_at_index(1) def test_volume(): assert well.volume == 0 def test_iterate_sources_tree(): result = well.iterate_sources_tree() assert isinstance(next(result), Well) def test_add_content(): plate = Plate96() well = plate.well_at_index(1) components_quantities = {"Compound_1": 5} volume = 20 * 10**(-6) # 20 uL well.add_content(components_quantities, volume=volume) assert well.content.quantities == {"Compound_1": 5} def test_subtract_content(): components_quantities = {"Compound_1": 5} volume = 30 * 10**(-6) # 30 uL with pytest.raises(TransferError):
import pytest from plateo import Transfer from plateo.containers.plates import Plate96 from plateo.Well import TransferError def test_TransferError(): with pytest.raises(ValueError): raise TransferError() source = Plate96(name="Source") destination = Plate96(name="Destination") source_well = source.wells["A1"] destination_well = destination.wells["B2"] volume = 25 * 10 ** (-6) transfer = Transfer(source_well, destination_well, volume) def test_to_plain_string(): assert transfer.to_plain_string() == "2.50E-05L from Source A1 into Destination B2" def test___repr__(): assert transfer.__repr__() == "2.50E-05L from Source A1 into Destination B2"