Skip to content

Commit

Permalink
Test convert_valuetable_to_volumetable()
Browse files Browse the repository at this point in the history
  • Loading branch information
veghp committed Oct 1, 2024
1 parent 83724c7 commit 631fff3
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 3 deletions.
26 changes: 26 additions & 0 deletions tests/data/applications/valuetable.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
,factor_1,factor_2,factor_3,complement,final_volume
units,uL,uL,uL,WATER,3
unit_1,0,0,0,,
unit_2,1,0,0,,
unit_3,0,1,0,,
unit_4,0,0,1,,
unit_5,1,1,0,,
unit_6,1,0,1,,
unit_7,0,1,1,,
unit_8,1,1,1,,
unit_9,0,0,0,,
unit_10,1,0,0,,
unit_11,0,1,0,,
unit_12,0,0,1,,
unit_13,1,1,0,,
unit_14,1,0,1,,
unit_15,0,1,1,,
unit_16,1,1,1,,
unit_17,0,0,0,,
unit_18,1,0,0,,
unit_19,0,1,0,,
unit_20,0,0,1,,
unit_21,1,1,0,,
unit_22,1,0,1,,
unit_23,0,1,1,,
unit_24,1,1,1,,
25 changes: 25 additions & 0 deletions tests/data/applications/volumetable_out.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
,factor_1,factor_2,factor_3,complement
unit_1,0.0,0.0,0.0,3.0
unit_2,1.0,0.0,0.0,2.0
unit_3,0.0,1.0,0.0,2.0
unit_4,0.0,0.0,1.0,2.0
unit_5,1.0,1.0,0.0,1.0
unit_6,1.0,0.0,1.0,1.0
unit_7,0.0,1.0,1.0,1.0
unit_8,1.0,1.0,1.0,0.0
unit_9,0.0,0.0,0.0,3.0
unit_10,1.0,0.0,0.0,2.0
unit_11,0.0,1.0,0.0,2.0
unit_12,0.0,0.0,1.0,2.0
unit_13,1.0,1.0,0.0,1.0
unit_14,1.0,0.0,1.0,1.0
unit_15,0.0,1.0,1.0,1.0
unit_16,1.0,1.0,1.0,0.0
unit_17,0.0,0.0,0.0,3.0
unit_18,1.0,0.0,0.0,2.0
unit_19,0.0,1.0,0.0,2.0
unit_20,0.0,0.0,1.0,2.0
unit_21,1.0,1.0,0.0,1.0
unit_22,1.0,0.0,1.0,1.0
unit_23,0.0,1.0,1.0,1.0
unit_24,1.0,1.0,1.0,0.0
30 changes: 27 additions & 3 deletions tests/test_doe.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
import filecmp
import os

import pandas

from plateo.applications.doe import (
import_valuetable_from_csv,
convert_valuetable_to_volumetable,
convert_volumetable_to_actiontable,
import_volumetable_from_csv_file,
)
from plateo.parsers import plate_from_content_spreadsheet
from plateo.containers import Plate96

valuetable_path = os.path.join("tests", "data", "applications", "valuetable.csv")
volumetable_out_path = os.path.join(
"tests", "data", "applications", "volumetable_out.csv"
)

volumetable_path = os.path.join("tests", "data", "applications", "volumetable.csv")
source_plate_path = os.path.join("tests", "data", "applications", "Source_Plate.xlsx")


def test_convert_valuetable_to_volumetable(tmpdir):
valuetable = import_valuetable_from_csv(valuetable_path)
volumetable = convert_valuetable_to_volumetable(valuetable)
volumetable.to_csv(
path_or_buf=os.path.join(tmpdir, "volumetable_out.csv"),
sep=",",
columns=None,
header=True,
index=True,
)
assert filecmp.cmp(
os.path.join(volumetable_out_path),
os.path.join(tmpdir, "volumetable_out.csv"),
)


def test_volumetable_from_csv_file():
assert type(import_volumetable_from_csv_file(volumetable_path)) == pandas.DataFrame
assert type(import_volumetable_from_csv_file(volumetable_path)) is pandas.DataFrame


def test_dataframe_from_volume_table():
def test_convert_volumetable_to_actiontable():
volumetable = import_volumetable_from_csv_file(volumetable_path)
source_plate = plate_from_content_spreadsheet(source_plate_path)
dest_plate = Plate96(name="dest")
dataframe = convert_volumetable_to_actiontable(
volumetable=volumetable, source_plate=source_plate, dest_plate=dest_plate
)

assert type(dataframe) == pandas.DataFrame
assert type(dataframe) is pandas.DataFrame

0 comments on commit 631fff3

Please sign in to comment.