コード例 #1
0
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"
コード例 #2
0
ファイル: test_well.py プロジェクト: pk-organics/Plateo
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}
コード例 #3
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test___repr__():
    assert Plate96().__repr__() == "Plate96(None)"
コード例 #4
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_iter_wells():
    result = Plate96().iter_wells()
    assert isinstance(next(result), Well)
コード例 #5
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_index_to_wellname(index, direction, expected):
    assert Plate96().index_to_wellname(index, direction) == expected
コード例 #6
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_wellname_to_index(wellname, direction, expected):
    assert Plate96().wellname_to_index(wellname, direction) == expected
コード例 #7
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_get_well_at_index():
    well = Plate96().well_at_index(5)
    assert well.name == "A5"
コード例 #8
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_wells_grouped_by():
    assert len(Plate96().wells_grouped_by()[0][1]) == 96
コード例 #9
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_wells_satisfying():
    def condition(well):
        return well.volume > 50

    assert type(Plate96().wells_satisfying(condition)) == filter
コード例 #10
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_wells_in_row():
    assert isinstance(Plate96().wells_in_row(5)[0], Well)
コード例 #11
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_wells_in_column():
    assert isinstance(Plate96().wells_in_column(5)[0], Well)
コード例 #12
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_list_well_data_fields():
    assert Plate96().list_well_data_fields() == []
コード例 #13
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_find_unique_well_containing():
    with pytest.raises(Exception):
        Plate96().find_unique_well_containing("testquery")
コード例 #14
0
ファイル: test_plate.py プロジェクト: pk-organics/Plateo
def test_find_unique_well_by_condition():
    with pytest.raises(Exception):
        Plate96().find_unique_well_by_condition(condition)
コード例 #15
0
ファイル: test_well.py プロジェクト: pk-organics/Plateo
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):
コード例 #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"