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"
Esempio n. 2
0
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}
Esempio n. 3
0
def test___repr__():
    assert Plate96().__repr__() == "Plate96(None)"
Esempio n. 4
0
def test_iter_wells():
    result = Plate96().iter_wells()
    assert isinstance(next(result), Well)
Esempio n. 5
0
def test_index_to_wellname(index, direction, expected):
    assert Plate96().index_to_wellname(index, direction) == expected
Esempio n. 6
0
def test_wellname_to_index(wellname, direction, expected):
    assert Plate96().wellname_to_index(wellname, direction) == expected
Esempio n. 7
0
def test_get_well_at_index():
    well = Plate96().well_at_index(5)
    assert well.name == "A5"
Esempio n. 8
0
def test_wells_grouped_by():
    assert len(Plate96().wells_grouped_by()[0][1]) == 96
Esempio n. 9
0
def test_wells_satisfying():
    def condition(well):
        return well.volume > 50

    assert type(Plate96().wells_satisfying(condition)) == filter
Esempio n. 10
0
def test_wells_in_row():
    assert isinstance(Plate96().wells_in_row(5)[0], Well)
Esempio n. 11
0
def test_wells_in_column():
    assert isinstance(Plate96().wells_in_column(5)[0], Well)
Esempio n. 12
0
def test_list_well_data_fields():
    assert Plate96().list_well_data_fields() == []
Esempio n. 13
0
def test_find_unique_well_containing():
    with pytest.raises(Exception):
        Plate96().find_unique_well_containing("testquery")
Esempio n. 14
0
def test_find_unique_well_by_condition():
    with pytest.raises(Exception):
        Plate96().find_unique_well_by_condition(condition)
Esempio n. 15
0
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):
Esempio n. 16
0
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"