示例#1
0
def test_add_content():
    plate = lab.Plate96()
    well = plate.get_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}
示例#2
0
def test_add_content():
    plate = lab.Plate96()
    well = plate.get_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}

    well2 = plate.get_well_at_index(2)
    well2.add_content(components_quantities, volume=20, unit_volume="uL")
    assert well2.content.concentration() == 250000.00000000003
示例#3
0
def test_apply():
    with pytest.raises(ValueError):
        transfer.apply()

    source_2 = lab.Plate96(name="Source_2")
    source_2.wells["A1"].add_content({"Compound_1": 1}, volume=5 * 10**(-6))
    destination_2 = lab.Plate96(name="Destination_2")
    transfer_2 = lab.Transfer(source_2.wells["A1"], destination_2.wells["B2"],
                              volume)

    with pytest.raises(ValueError):
        transfer_2.apply()

    source_2.wells["A1"].add_content({"Compound_1": 1}, volume=25 * 10**(-6))
    destination_2.wells["B2"].capacity = 3 * 10**(-6)
    with pytest.raises(ValueError):
        transfer_2.apply()

    destination_2.wells["B2"].capacity = 50 * 10**(-6)
    transfer_2.apply()
    assert destination_2.wells["B2"].volume == volume
示例#4
0
def test_index_to_wellname(index, direction, expected):
    assert lab.Plate96().index_to_wellname(index, direction) == expected
示例#5
0
def test_wellname_to_index(wellname, direction, expected):
    assert lab.Plate96().wellname_to_index(wellname, direction) == expected
示例#6
0
def test_get_well_at_index():
    well = lab.Plate96().get_well_at_index(5)
    assert well.name == "A5"
示例#7
0
def test_wells_grouped_by():
    assert len(lab.Plate96().wells_grouped_by()[0][1]) == 96
示例#8
0
def test_list_filtered_wells():
    def condition(well):
        return well.volume > 50

    assert lab.Plate96().list_filtered_wells(condition) == []
示例#9
0
def test_list_wells_in_row():
    assert isinstance(lab.Plate96().list_wells_in_row(5)[0], Well)
示例#10
0
def test_return_column():
    assert isinstance(lab.Plate96().return_column(5)[0], Well)
    assert len(lab.Plate96().return_column(5)) == 8
示例#11
0
def test_find_unique_well_containing():
    with pytest.raises(Exception):
        lab.Plate96().find_unique_well_containing("testquery")
示例#12
0
def test_find_unique_well_by_condition():
    with pytest.raises(Exception):
        lab.Plate96().find_unique_well_by_condition(condition)
示例#13
0
# pylint: disable=C0114,E0401,C0103,C0116
import pytest

import synbiopython.lab_automation as lab


def test_TransferError():
    with pytest.raises(ValueError):
        raise lab.TransferError()


source = lab.Plate96(name="Source")
destination = lab.Plate96(name="Destination")
source_well = source.wells["A1"]
destination_well = destination.wells["B2"]
volume = 25 * 10**(-6)
transfer = lab.Transfer(source_well, destination_well, volume)


def test_to_plain_string():
    assert (transfer.to_plain_string() ==
            "Transfer 2.50E-05L from Source A1 into Destination B2")


def test_to_short_string():
    assert (transfer.to_short_string() ==
            "Transfer 2.50E-05L (Source-A1) -> (Destination-B2)")


def test_with_new_volume():
    new_volume = 50 * 10**(-7)
示例#14
0
# pylint: disable=C0114,E0401,C0103,C0116,W0621
import pytest

import synbiopython.lab_automation as lab
from synbiopython.lab_automation.picklist.Transfer import TransferError
from synbiopython.lab_automation.containers.Well import Well

plate = lab.Plate96()
well = plate.get_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 = lab.Plate96()
    well = plate.get_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}

    well2 = plate.get_well_at_index(2)
    well2.add_content(components_quantities, volume=20, unit_volume="uL")
    assert well2.content.concentration() == 250000.00000000003
示例#15
0
def test_return_row():
    assert isinstance(lab.Plate96().return_row("A")[0], Well)
    assert isinstance(lab.Plate96().return_row(1)[0], Well)
    assert len(lab.Plate96().return_row("A")) == 12
示例#16
0
def test_iter_wells():
    result = lab.Plate96().iter_wells()
    assert isinstance(next(result), Well)
示例#17
0
def test___repr__():
    assert lab.Plate96().__repr__() == "Plate96(None)"
示例#18
0
def test_list_well_data_fields():
    with pytest.raises(KeyError):
        lab.Plate96().list_well_data_fields()